From 380b6acb7a43872fc2d834d7107ef5a03028696e Mon Sep 17 00:00:00 2001 From: Matthew Murphy Date: Wed, 3 Mar 2021 11:28:00 -0800 Subject: [PATCH] Fix build tool dependencies and ids in release workflow (#22) * Fix build tool dependencies and ids in release workflow * Add build instructions to the README --- .github/workflows/release.yml | 8 ++++---- README.md | 18 ++++++++++++++++++ environment.sh | 8 ++++++++ go.mod | 5 ++--- go.sum | 19 ++++++++++++++----- tools.go | 11 +++++++++++ 6 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 environment.sh create mode 100644 tools.go diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e7c9730..b5d3a61 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: draft: false prerelease: false - name: Upload Windows Release Asset - id: upload-release-asset + id: upload-release-asset-windows uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -52,7 +52,7 @@ jobs: asset_name: bundle-helper.windows.amd64.exe asset_content_type: application/octet-stream - name: Upload Linux amd64 Release Asset - id: upload-release-asset + id: upload-release-asset-linux-amd64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -62,7 +62,7 @@ jobs: asset_name: bundle-helper.linux.amd64 asset_content_type: application/octet-stream - name: Upload Linux arm Release Asset - id: upload-release-asset + id: upload-release-asset-linux-arm uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -72,7 +72,7 @@ jobs: asset_name: bundle-helper.linux.arm asset_content_type: application/octet-stream - name: Upload Darwin amd64 Release Asset - id: upload-release-asset + id: upload-release-asset-darwin-amd64 uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 13209f6..3363452 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,24 @@ directory mounted as '/cache' in the Docker container you should set prefix to ' ``` +## Developing + +In order to build and run this package from source you should execute the following (Golang 1.16+ recommended): + +``` +source environment.sh +go get github.com/mitchellh/gox +go get github.com/golang/mock/gomock +go install github.com/golang/mock/mockgen +go build ./... +go generate ./... +go test -v -race ./... +``` + +`environment.sh` is used to set `GOBIN` so that `mockgen` installs properly using Go modules. + +NOTE: If you are using Golang version < 1.16 then you may need to set the environment variable `GO111MODULES=on`. + ## License This library is licensed under the Apache 2.0 License. diff --git a/environment.sh b/environment.sh new file mode 100644 index 0000000..214b3e9 --- /dev/null +++ b/environment.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +# Simple environment setup to work on a single go package +# https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md +# https://golang.org/cmd/go/#hdr-Environment_variables + +export GOBIN=$PWD/bin +export PATH=$GOBIN:$PATH \ No newline at end of file diff --git a/go.mod b/go.mod index 36da1b9..e57e695 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,9 @@ go 1.11 require ( github.com/aws/aws-sdk-go v1.19.11 - github.com/golang/mock v1.4.4 + github.com/golang/mock v1.5.0 github.com/google/uuid v1.1.1 - github.com/mitchellh/gox v1.0.0 // indirect + github.com/mitchellh/gox v1.0.1 // indirect github.com/stretchr/testify v1.3.0 github.com/urfave/cli v1.20.0 - golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 // indirect ) diff --git a/go.sum b/go.sum index 75c2205..958bfe7 100644 --- a/go.sum +++ b/go.sum @@ -2,18 +2,18 @@ github.com/aws/aws-sdk-go v1.19.11 h1:tqaTGER6Byw3QvsjGW0p018U2UOqaJPeJuzoaF7jjo github.com/aws/aws-sdk-go v1.19.11/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0 h1:jlYHihg//f7RRwuPfptm04yp4s7O6Kw8EZiVYIGcH0g= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/go-version v1.0.0 h1:21MVWPKDphxa7ineQQTrCU5brh7OuVVAzGOCnnCPtE8= github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/mitchellh/gox v1.0.0 h1:7ENCygwtc/7barDq96k0JPZhvrpHO/7oihNahmrmAhg= -github.com/mitchellh/gox v1.0.0/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= +github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI= +github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4= 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= @@ -24,12 +24,21 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262 h1:qsl9y/CJx34tuA7QCPNp86JNJe4spst6Ff8MjvPUdPg= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e h1:aZzprAO9/8oim3qStq3wc1Xuxx4QmAGriC4VU4ojemQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/tools.go b/tools.go new file mode 100644 index 0000000..ce68c20 --- /dev/null +++ b/tools.go @@ -0,0 +1,11 @@ +// +build tools + +// This file is used to version lock build tool dependencies +// See https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module +package tools + +import ( + _ "github.com/golang/mock/gomock" + _ "github.com/golang/mock/mockgen" + _ "github.com/mitchellh/gox" +)