github.com/aloncn/graphics-go@v0.0.1/src/cmd/go/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 main
     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 +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  	ReleaseTags   []string `json:",omitempty"` // releases the current release is compatible with
    21  	InstallSuffix string   `json:",omitempty"` // suffix to use in the name of the install dir
    22  }
    23  
    24  func newContext(c *build.Context) *Context {
    25  	return &Context{
    26  		GOARCH:        c.GOARCH,
    27  		GOOS:          c.GOOS,
    28  		GOROOT:        c.GOROOT,
    29  		CgoEnabled:    c.CgoEnabled,
    30  		UseAllFiles:   c.UseAllFiles,
    31  		Compiler:      c.Compiler,
    32  		BuildTags:     c.BuildTags,
    33  		ReleaseTags:   c.ReleaseTags,
    34  		InstallSuffix: c.InstallSuffix,
    35  	}
    36  }