forked from mitchellh/gox
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f6a8ea
commit 16cc89c
Showing
10 changed files
with
314 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
package main | ||
|
||
const ( | ||
gobin = "go" | ||
) | ||
|
||
const ( | ||
flagNameRace = "race" | ||
flagNameMSAN = "msan" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package main | ||
|
||
import "github.com/hashicorp/go-version" | ||
|
||
var ( | ||
flagConstraints map[string]version.Constraints | ||
platformConstraints []PlatformConstraint | ||
experimentConstraints map[string]version.Constraints | ||
) | ||
|
||
// Parse all of the constraints as efficiently as possible. | ||
func init() { | ||
var ( | ||
ok bool | ||
constraint version.Constraints | ||
err error | ||
) | ||
|
||
parsed := map[string]version.Constraints{} | ||
|
||
flagConstraints = map[string]version.Constraints{} | ||
|
||
flagConstraintsInputs := []struct { | ||
name string | ||
constraint string | ||
}{ | ||
{"C", ">= 1.20"}, | ||
{flagNameASAN, ">= 1.18"}, | ||
{flagNameCover, ">= 1.20"}, | ||
{flagNameCoverPKG, ">= 1.20"}, | ||
{flagNameBuildVCS, ">= 1.18"}, | ||
{flagNameModCacheRW, ">= 1.14"}, | ||
{flagNameMod, ">= 1.11"}, | ||
{flagNameModFile, ">= 1.14"}, | ||
{flagNameOverlay, ">= 1.16"}, | ||
{flagNameProfileGuidedOptimization, ">= 1.20"}, | ||
{flagNameTrimPath, ">= 1.13"}, | ||
} | ||
|
||
for _, input := range flagConstraintsInputs { | ||
if constraint, ok = parsed[input.constraint]; ok { | ||
flagConstraints[input.name] = constraint | ||
|
||
continue | ||
} | ||
|
||
if constraint, err = version.NewConstraint(input.constraint); err != nil { | ||
panic(err) | ||
} | ||
|
||
flagConstraints[input.name] = constraint | ||
parsed[input.constraint] = constraint | ||
} | ||
|
||
platformConstraintsInputs := []struct { | ||
constraint string | ||
platforms []Platform | ||
}{ | ||
{"<= 1.0", Platforms_1_0}, | ||
{">= 1.1, < 1.3", Platforms_1_1}, | ||
{">= 1.3, < 1.4", Platforms_1_3}, | ||
{">= 1.4, < 1.5", Platforms_1_4}, | ||
{">= 1.5, < 1.6", Platforms_1_5}, | ||
{">= 1.6, < 1.7", Platforms_1_6}, | ||
{">= 1.7, < 1.8", Platforms_1_7}, | ||
{">= 1.8, < 1.9", Platforms_1_8}, | ||
{">= 1.9, < 1.10", Platforms_1_9}, | ||
{">= 1.10, < 1.11", Platforms_1_10}, | ||
{">= 1.11, < 1.12", Platforms_1_11}, | ||
{">= 1.12, < 1.13", Platforms_1_12}, | ||
{">= 1.13, < 1.14", Platforms_1_13}, | ||
{">= 1.14, < 1.15", Platforms_1_14}, | ||
{">= 1.15, < 1.16", Platforms_1_15}, | ||
{">= 1.16, < 1.17", Platforms_1_16}, | ||
{">= 1.17, < 1.18", Platforms_1_17}, | ||
{">= 1.18, < 1.19", Platforms_1_18}, | ||
{">= 1.19, < 1.20", Platforms_1_19}, | ||
{">= 1.20, < 1.21", Platforms_1_20}, | ||
} | ||
|
||
platformConstraints = make([]PlatformConstraint, len(platformConstraintsInputs)) | ||
|
||
for i, input := range platformConstraintsInputs { | ||
if constraint, ok = parsed[input.constraint]; ok { | ||
platformConstraints[i] = PlatformConstraint{Constraints: constraint, Platforms: input.platforms} | ||
|
||
continue | ||
} | ||
|
||
if constraint, err = version.NewConstraint(input.constraint); err != nil { | ||
panic(err) | ||
} | ||
|
||
platformConstraints[i] = PlatformConstraint{Constraints: constraint, Platforms: input.platforms} | ||
parsed[input.constraint] = constraint | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,21 @@ | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= | ||
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= | ||
github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= | ||
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= | ||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= | ||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= | ||
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= | ||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.