github.com/sirkon/goproxy@v1.4.8/internal/imports/tags.go (about)

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package imports
     6  
     7  import "github.com/sirkon/goproxy/internal/cfg"
     8  
     9  var tags map[string]bool
    10  
    11  func Tags() map[string]bool {
    12  	if tags == nil {
    13  		tags = loadTags()
    14  	}
    15  	return tags
    16  }
    17  
    18  func loadTags() map[string]bool {
    19  	tags := map[string]bool{
    20  		cfg.BuildContext.GOOS:     true,
    21  		cfg.BuildContext.GOARCH:   true,
    22  		cfg.BuildContext.Compiler: true,
    23  	}
    24  	if cfg.BuildContext.CgoEnabled {
    25  		tags["cgo"] = true
    26  	}
    27  	for _, tag := range cfg.BuildContext.BuildTags {
    28  		tags[tag] = true
    29  	}
    30  	for _, tag := range cfg.BuildContext.ReleaseTags {
    31  		tags[tag] = true
    32  	}
    33  	return tags
    34  }