From 1f8b748c384d37b67690060c6f17da35867c9cfc Mon Sep 17 00:00:00 2001 From: Dave Hall Date: Mon, 25 Oct 2021 00:46:14 +1100 Subject: [PATCH] Switch to /bin/sh Related changes: * Fix checks for gofmt and gofmt errors * Use $() over `` --- Tools/src/checkstyle.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Tools/src/checkstyle.sh b/Tools/src/checkstyle.sh index 9fb02997..931b6d87 100755 --- a/Tools/src/checkstyle.sh +++ b/Tools/src/checkstyle.sh @@ -1,10 +1,10 @@ -#!/usr/bin/env bash +#!/bin/sh echo "Run checkstyle script" # run gofmt echo "Run 'gofmt'" -unformatted=$(gofmt -l `pwd`/src/) -if [[ -n $unformatted ]]; then +unformatted=$(gofmt -l $(pwd)/src/) +if [ -n "$unformatted" ]; then echo >&2 "Error: Found files not formatted by gofmt" for fi in $unformatted; do echo >&2 $fi @@ -15,11 +15,11 @@ fi # run goimports echo "Try update 'goimports'" -GOPATH=`pwd`/Tools go get golang.org/x/tools/cmd/goimports +GOPATH=$(pwd)/Tools go get golang.org/x/tools/cmd/goimports echo "Run 'goimports'" -unformatted=$(Tools/bin/goimports -l `pwd`/src/) -if [[ -n $unformatted ]]; then +unformatted=$(Tools/bin/goimports -l $(pwd)/src/) +if [ -n "$unformatted" ]; then echo >&2 "Error: Found files not formatted by goimports" for f in $unformatted; do echo >&2 $f @@ -29,5 +29,5 @@ if [[ -n $unformatted ]]; then fi echo "Run 'go vet'" -ln -s `pwd` `pwd`/vendor/src/github.com/aws/SSMCLI +ln -s $(pwd) $(pwd)/vendor/src/github.com/aws/SSMCLI go vet ./src/...