Debian Codegraph @

infra/bots/deps/deps.go

raw
1 // Copyright 2024 Google LLC
2 //
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 //go:generate bazelisk run //:go -- run ./generate.go
7 package deps
8
9 import (
10 "go.skia.org/infra/go/depot_tools/deps_parser"
11 "go.skia.org/infra/go/skerr"
12 )
13
14 // Get retrieves the given dependency. Returns an error of the given dependency
15 // does not exist.
16 func Get(dep string) (*deps_parser.DepsEntry, error) {
17 entry := deps.Get(dep)
18 if entry == nil {
19 return nil, skerr.Fmt("unknown dependency %q (normalized as %q)", dep, deps_parser.NormalizeDep(dep))
20 }
21 // Return a copy to prevent modification of the package-local entries.
22 return &deps_parser.DepsEntry{
23 Id: entry.Id,
24 Version: entry.Version,
25 Path: entry.Path,
26 }, nil
27 }