github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/lib/buildinfo/tags.go (about) 1 // Package buildinfo provides build information. 2 package buildinfo 3 4 import ( 5 "sort" 6 "strings" 7 ) 8 9 // Tags contains slice of build tags. 10 // The `cmount` tag is added by cmd/cmount/mount.go only if build is static. 11 // The `noselfupdate` tag is added by cmd/selfupdate/noselfupdate.go 12 // Other tags including `cgo` are detected in this package. 13 var Tags []string 14 15 // GetLinkingAndTags tells how the rclone executable was linked 16 // and returns space separated build tags or the string "none". 17 func GetLinkingAndTags() (linking, tagString string) { 18 linking = "static" 19 tagList := []string{} 20 for _, tag := range Tags { 21 if tag == "cgo" { 22 linking = "dynamic" 23 } else { 24 tagList = append(tagList, tag) 25 } 26 } 27 if len(tagList) > 0 { 28 sort.Strings(tagList) 29 tagString = strings.Join(tagList, " ") 30 } else { 31 tagString = "none" 32 } 33 return 34 }