From 3c14a59cbb8426d8ce0716b520aa0a7c847a3d74 Mon Sep 17 00:00:00 2001 From: Filippe Spolti Date: Wed, 29 Nov 2023 22:23:26 -0300 Subject: [PATCH] chore: Upgrade Golang version from 1.18 to 1.19 (#28) - Remove the linters for "deadcode", "structcheck", "varcheck" - Use "os" packages instead of deprecated "io/ioutil" (SA1019) - Capture pre-commit output in a local log file --------- Signed-off-by: Spolti --- .dockerignore | 8 ++++++++ .gitignore | 3 +++ .pre-commit-config.yaml | 2 ++ Dockerfile | 1 + go.sum | 2 ++ scripts/fmt.sh | 6 +++--- 6 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d7898a3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.env +.dockerignore +.vscode +.DS_Store +Dockerfile +temp +.pre-commit.log + diff --git a/.gitignore b/.gitignore index 3a8674b..cd00ded 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ google/ # IDE .idea/ + +.pre-commit.log + diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3b7dca5..980c3d4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,6 +16,7 @@ repos: rev: v1.51.1 hooks: - id: golangci-lint + log_file: .pre-commit.log entry: golangci-lint run exclude: ^(gen/) args: @@ -24,6 +25,7 @@ repos: rev: v2.4.1 hooks: - id: prettier + log_file: .pre-commit.log exclude: ^(.github/) args: - --no-bracket-spacing diff --git a/Dockerfile b/Dockerfile index 742acbd..cdd44e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -94,6 +94,7 @@ RUN true \ COPY .pre-commit-config.yaml ./ RUN git init && \ pre-commit install-hooks && \ + git config --global --add safe.directory "*" && \ rm -rf .git # Download dependencies before copying the source so they will be cached diff --git a/go.sum b/go.sum index a02edb6..4c46490 100644 --- a/go.sum +++ b/go.sum @@ -13,6 +13,7 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8Wd github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -127,6 +128,7 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.26.0 h1:IpPlZnxBpV1xl7TGk/X6lFtpgjgntCg8PJ+qrPHAC7I= k8s.io/apimachinery v0.27.0 h1:vEyy/PVMbPMCPutrssCVHCf0JNZ0Px+YqPi82K2ALlk= k8s.io/apimachinery v0.27.0/go.mod h1:5ikh59fK3AJ287GUvpUsryoMFtH9zj/ARfWCo3AyXTM= diff --git a/scripts/fmt.sh b/scripts/fmt.sh index cdbc0ed..df3f8d3 100755 --- a/scripts/fmt.sh +++ b/scripts/fmt.sh @@ -11,7 +11,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License.# +# limitations under the License. # Fix: 'fatal: detected dubious ownership in repository', # only do this if it is running into the develop image @@ -22,8 +22,8 @@ fi pre-commit run --all-files RETURN_CODE=$? ## cat this file for helping on identifying the root cause when some issue happens -if [ -f /$USER/.cache/pre-commit/pre-commit.log ]; then - cat /$USER/.cache/pre-commit/pre-commit.log +if [ -f .pre-commit.log ]; then + cat .pre-commit.log fi function echoError() {