10 examples of 'golang build tags' in Go

Every line of 'golang build tags' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
66func (f *Fake) NewTagFromLatest(repoPath string, event *api.Event) error {
67 log.InfoWithFields("Successfully created a new fake tag.", log.Fields{"repoPath": repoPath})
68 return nil
69}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

253func findLatestMLBuilderImageVersion() (string, error) {
254 return findLatestImageVersion("gcr.io/jenkinsxio/builder-machine-learning")
255}
337func getTag(ref reference.Named) string {
338 switch x := ref.(type) {
339 case reference.Canonical, reference.Digested:
340 return ""
341 case reference.NamedTagged:
342 return x.Tag()
343 default:
344 return ""
345 }
346}
16func (d Docker) GetTag() string {
17 if d.Tag == "" {
18 return "latest"
19 }
20 return d.Tag
21}
34func (s *Scanner) tag(line string) string {
35 matches := nameRgxp.FindStringSubmatch(line)
36 if matches == nil {
37 return ""
38 }
39 return matches[1]
40}
27func tagFromName(name string) string {
28 parts := strings.Split(name, ":")
29 if len(parts) < 2 {
30 return ""
31 }
32 return parts[1]
33}
46func (m *Make) ApplyDefaultTags() {
47 for _, tag := range m.DefaultTags {
48 for i, mt := range m.Tasks {
49 if !utility.StringSliceContains(mt.Tags, tag) && !utility.StringSliceContains(mt.ExcludeTags, tag) {
50 m.Tasks[i].Tags = append(m.Tasks[i].Tags, tag)
51 }
52 }
53 }
54}
55func ArchTag(hasTag bool) string {
56 if runtime.GOARCH == "amd64" && !hasTag {
57 return ":"
58 }
59 return "-" + runtime.GOARCH + ":"
60}
156func getBuildArgs() (leeway.Arguments, error) {
157 if len(buildArgs) == 0 {
158 return nil, nil
159 }
160
161 res := make(leeway.Arguments)
162 for _, arg := range buildArgs {
163 segs := strings.Split(arg, "=")
164 if len(segs) < 2 {
165 return nil, xerrors.Errorf("invalid build argument (format is key=value): %s", arg)
166 }
167 res[segs[0]] = strings.Join(segs[1:], "=")
168 }
169 return res, nil
170}
249func findLatestBuilderImageVersion() (string, error) {
250 return findLatestImageVersion("gcr.io/jenkinsxio/builder-maven")
251}

Related snippets