github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/go/list/context.go (about) 1 // Copyright 2014 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 list 6 7 import ( 8 "go/build" 9 ) 10 11 type Context struct { 12 GOARCH string `json:",omitempty"` // target architecture 13 GOOS string `json:",omitempty"` // target operating system 14 GOROOT string `json:",omitempty"` // Go root 15 GOPATH string `json:",omitempty"` // Go path 16 CgoEnabled bool `json:",omitempty"` // whether cgo can be used 17 UseAllFiles bool `json:",omitempty"` // use files regardless of //go:build lines, file names 18 Compiler string `json:",omitempty"` // compiler to assume when computing target paths 19 BuildTags []string `json:",omitempty"` // build constraints to match in +build lines 20 ToolTags []string `json:",omitempty"` // toolchain-specific build constraints 21 ReleaseTags []string `json:",omitempty"` // releases the current release is compatible with 22 InstallSuffix string `json:",omitempty"` // suffix to use in the name of the install dir 23 } 24 25 func newContext(c *build.Context) *Context { 26 return &Context{ 27 GOARCH: c.GOARCH, 28 GOOS: c.GOOS, 29 GOROOT: c.GOROOT, 30 GOPATH: c.GOPATH, 31 CgoEnabled: c.CgoEnabled, 32 UseAllFiles: c.UseAllFiles, 33 Compiler: c.Compiler, 34 BuildTags: c.BuildTags, 35 ToolTags: c.ToolTags, 36 ReleaseTags: c.ReleaseTags, 37 InstallSuffix: c.InstallSuffix, 38 } 39 }