mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Internals: Switch to v2 go.mod, drop GOPATH, and fix Azure Pipelines (#595)
* Switched to v2 go.mod Also set GO111MODULE=on in build stuff to always use Go modules even when in GOPATH. * Ensure go.mod, go.sum, and vendor are up to date * Attempt to fix Azure pipelines * Add set -e to properly fail on exit (it didn't seem to be propagating properly before). * Set workingDirectory for GoFmt and GoGen (this might be why it fails unlike compile and unitests). * Another attempt to fix Azure Pipelines * Use the Go env template for all go-related jobs. * Completely fixed Azure Pipelines * Added a display name to GoFmt for consistency. * Fixed diffs for GoFmt and GoGen. * Show git status for checks. * Drop GOPATH for tests TODO: Do the same for integration tests. * Drop GOPATH for integration tests * Show more diffs * Regenerate provider support matrix This wasn't done in #590...
This commit is contained in:
committed by
Tom Limoncelli
parent
d19eedaa63
commit
2f83aa9302
@@ -1,12 +1,6 @@
|
||||
# shared step for setting up go env
|
||||
# see https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/go?view=azure-devops#build-a-container-image
|
||||
steps:
|
||||
- script: |
|
||||
mkdir -p '$(GOBIN)'
|
||||
mkdir -p '$(GOPATH)/pkg'
|
||||
mkdir -p '$(modulePath)'
|
||||
shopt -s extglob
|
||||
mv !(gopath) '$(modulePath)'
|
||||
echo '##vso[task.prependpath]$(GOBIN)'
|
||||
echo '##vso[task.prependpath]$(GOROOT)/bin'
|
||||
displayName: 'Set up the Go workspace'
|
||||
- task: GoTool@0
|
||||
inputs:
|
||||
version: '1.13.6'
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
variables:
|
||||
GOBIN: '$(GOPATH)/bin' # Go binaries path
|
||||
GOROOT: '/usr/local/go1.13' # Go installation path
|
||||
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
|
||||
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code
|
||||
wd: '$(modulePath)/integrationTest'
|
||||
wd: '$(System.DefaultWorkingDirectory)/integrationTest'
|
||||
|
||||
trigger:
|
||||
batch: "true"
|
||||
|
||||
@@ -17,12 +17,13 @@ var goos = flag.String("os", "", "OS to build (linux, windows, or darwin) Defaul
|
||||
func main() {
|
||||
flag.Parse()
|
||||
flags := fmt.Sprintf(`-s -w -X main.SHA="%s" -X main.BuildTime=%d`, getVersion(), time.Now().Unix())
|
||||
pkg := "github.com/StackExchange/dnscontrol"
|
||||
pkg := "github.com/StackExchange/dnscontrol/v2"
|
||||
|
||||
build := func(out, goos string) {
|
||||
log.Printf("Building %s", out)
|
||||
cmd := exec.Command("go", "build", "-o", out, "-ldflags", flags, pkg)
|
||||
os.Setenv("GOOS", goos)
|
||||
os.Setenv("GO111MODULE", "on")
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
err := cmd.Run()
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"io/ioutil"
|
||||
"sort"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/providers"
|
||||
_ "github.com/StackExchange/dnscontrol/providers/_all"
|
||||
"github.com/StackExchange/dnscontrol/v2/providers"
|
||||
_ "github.com/StackExchange/dnscontrol/v2/providers/_all"
|
||||
)
|
||||
|
||||
func generateFeatureMatrix() error {
|
||||
|
||||
Reference in New Issue
Block a user