@@ -3,7 +3,8 @@ set -eu -o pipefail
3
3
4
4
_version=1.0.${CIRCLE_BUILD_NUM-0} -$( git rev-parse --short HEAD 2> /dev/null || echo latest)
5
5
reportDir=" test-reports"
6
- serviceName=" ex-service-template"
6
+ serviceName=" ex-service-template" # FIXME: update with the new service name
7
+ package=" github.com/circleci/${serviceName} "
7
8
8
9
make-target () {
9
10
mkdir -p " target"
@@ -35,7 +36,7 @@ help_build="Build the binaries for production"
35
36
build () {
36
37
local date ldflags
37
38
date=$( date " +%FT%T%z" )
38
- ldflags=" -s -w -X github.com/circleci/ ${serviceName } /cmd.Version=$_version -X github.com/circleci/ ${serviceName } /cmd.Date=$date "
39
+ ldflags=" -s -w -X ${package } /cmd.Version=$_version -X ${package } /cmd.Date=$date "
39
40
40
41
GOOS=linux GOARCH=amd64 binary " $ldflags " &
41
42
@@ -59,7 +60,7 @@ build() {
59
60
# shellcheck disable=SC2034
60
61
help_lint=" Run golanci-lint to lint go files."
61
62
lint () {
62
- exec ./bin/ golangci-lint run " ${@:- ./ ...} "
63
+ exec go tool golangci-lint run " ${@:- ./ ...} "
63
64
}
64
65
65
66
# This variable is used, but shellcheck can't tell.
@@ -79,26 +80,25 @@ help_test="Run normal unit tests"
79
80
test () {
80
81
mkdir -p " ${reportDir} "
81
82
# -count=1 is used to forcibly disable test result caching
82
- ./bin/ gotestsum --junitfile=" ${reportDir} /junit.xml" -- -race -count=1 " ${@:- ./ ...} "
83
+ go tool gotestsum --junitfile=" ${reportDir} /junit.xml" -- -race -count=1 " ${@:- ./ ...} "
83
84
}
84
85
85
86
# This variable is used, but shellcheck can't tell.
86
87
# shellcheck disable=SC2034
87
88
help_run_goimports=" Run goimports for package"
88
89
run-goimports () {
89
- ./bin/ gosimports -local " github.com/circleci/ex-service-template " -w
90
+ go tool gosimports -local " ${package} " -w .
90
91
}
91
92
92
93
# This variable is used, but shellcheck can't tell.
93
94
# shellcheck disable=SC2034
94
95
help_godoc=" Run godoc to read documentation."
95
96
godoc () {
96
- install-go-bin " golang.org/x/tools/cmd/godoc@v0.1.3"
97
97
local url
98
- url=" http://localhost:6060/pkg/github.com/circleci/ ${serviceName } /"
98
+ url=" http://localhost:6060/pkg/${package } /"
99
99
command -v xdg-open && xdg-open $url &
100
100
command -v open && open $url &
101
- ./bin/ godoc -http=127.0.0.1:6060
101
+ go tool godoc -http=127.0.0.1:6060
102
102
}
103
103
104
104
# This variable is used, but shellcheck can't tell.
@@ -108,29 +108,6 @@ go-mod-tidy() {
108
108
go mod tidy -v
109
109
}
110
110
111
- install-go-bin () {
112
- local binDir=" $PWD /bin"
113
- for pkg in " ${@ } " ; do
114
- echo " ${pkg} "
115
- (
116
- cd tools
117
- GOBIN=" ${binDir} " go install " ${pkg} "
118
- )
119
- done
120
- }
121
-
122
- # This variable is used, but shellcheck can't tell.
123
- # shellcheck disable=SC2034
124
- help_install_devtools=" Install tools that other tasks expect into ./bin"
125
- install-devtools () {
126
- local tools=()
127
- while IFS=' ' read -r value; do
128
- tools+=(" $value " )
129
- done < <( grep _ tools/tools.go | awk -F' "' ' {print $2}' )
130
-
131
- install-go-bin " ${tools[@]} "
132
- }
133
-
134
111
# This variable is used, but shellcheck can't tell.
135
112
# shellcheck disable=SC2034
136
113
help_create_stub_test_files=" Create an empty pkg_test in all directories with no tests.
@@ -145,14 +122,6 @@ create-stub-test-files() {
145
122
xargs -r --max-args=2 bash -c ' echo "package $0" > "$1/pkg_test.go"'
146
123
}
147
124
148
- # This variable is used, but shellcheck can't tell.
149
- # shellcheck disable=SC2034
150
- help_run_goimports=" Run goimports for package"
151
- run-goimports () {
152
- command -v ./bin/goimports || install-go-bin " golang.org/x/tools/cmd/goimports@v0.0.0-20201208183658-cc330816fc52"
153
- ./bin/goimports -local " github.com/circleci/${serviceName} " -w " ${@:- .} "
154
- }
155
-
156
125
# This variable is used, but shellcheck can't tell.
157
126
# shellcheck disable=SC2034
158
127
help_version=" Print version"
0 commit comments