Commit Graph

7 Commits

Author SHA1 Message Date
Joakim Roubert 8d19b4055b
Improve shellscript portability by using /bin/env (#4628)
Using `/bin/env` increases portability for the shell scripts (and often using `/bin/env` is requested by e.g. Mac users). This would also facilitate testing scripts with different Bash versions via the Bash containers, as they have bash in `/usr/local` and not `/bin`. Using `/bin/env`, there is no need to change the script when testing. (I assume the latter was behind c301ea214b (diff-ecec5e3a811f60bc2739019004fa35b0), which would not happen using `/bin/env`.)

Signed-off-by: Joakim Roubert <joakimr@axis.com>
2020-06-19 15:49:29 -04:00
Alex Leong 015d352f34
Fix array handling in bin/fmt (#4489)
Quoting the list of directories passed to `goimports` was causing the list to be interpreted as a single argument which was stopping `bin/fmt` from working.

Instead, use `read` to split the list of directories into an array.

Also fix up incorrect formatting that has crept in while `bin/fmt` has been broken.

Signed-off-by: Alex Leong <alex@buoyant.io>
2020-06-01 12:10:24 -07:00
Joakim Roubert 30ba9a1261
bin/fmt: Fix shellcheck issue (#4438)
Signed-off-by: Joakim Roubert <joakimr@axis.com>
2020-05-19 14:49:28 -07:00
Joakim Roubert 1e8bfed83f
bin/fmt: Use sort -u instead of sort | uniq (#4418)
No need to pipe output to another program when the functionality
exists in sort.

Signed-off-by: Joakim Roubert <joakimr@axis.com>
2020-05-18 09:52:53 -07:00
Joakim Roubert 0b58a56637
Use -n instead of ! -z in shell scripts (#4404)
Signed-off-by: Joakim Roubert <joakim.roubert@axis.com>
2020-05-15 14:03:06 -05:00
Alex Leong d8eebee4f7
Upgrade to client-go 0.17.4 and smi-sdk-go 0.3.0 (#4221)
Here we upgrade our dependencies on client-go to 0.17.4 and smi-sdk-go to 0.3.0.  Since smi-sdk-go uses client-go 0.17.4, these upgrades must be performed simultaneously.

This also requires simultaneously upgrading our dependency on linkerd/stern to a SHA which also uses client-go 0.17.4.  This keeps all of our transitive dependencies synchronized on one version of client-go.

This ALSO requires updating our codegen scripts to use the 0.17.4 version of code-generator and running it to generate 0.17.4 compatible generated code.  I took this opportunity to update our code generation script to properly use the version of code-generater from `go.mod` rather than a hardcoded SHA.

Signed-off-by: Alex Leong <alex@buoyant.io>
2020-04-01 10:07:23 -07:00
Alex Leong 3dcff52b9f
Switch from using golangci fmt to using goimports (#3555)
CI currently enforcing formatting rules by using the fmt linter of golang-ci-lint which is invoked from the bin/lint script.  However it doesn't seem possible to use golang-ci-lint as a formatter, only as a linter which checks formatting.  This means any formatter used by your IDE or invoked manually may or may not use the same formatting rules as golang-ci-lint depending on which formatter you use and which specific revision of that formatter you use.  

In this change we stop using golang-ci-lint for format checking.  We introduce `tools.go` and add goimports to the `go.mod` and `go.sum` files.  This allows everyone to easily get the same revision of goimports by running `go install -mod=readonly golang.org/x/tools/cmd/goimports` from inside of the project.  We add a step in the CI workflow that uses goimports via the `bin/fmt` script to check formatting.

Some shell gymnastics were required in the `bin/fmt` script to work around some limitations of `goimports`:
* goimports does not have a built-in mechanism for excluding directories, and we need to exclude the vendor director as well as the generated Go sources
* goimports returns a 0 exit code, even when formatting errors are detected

Signed-off-by: Alex Leong <alex@buoyant.io>
2019-10-16 13:56:11 -07:00