diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 3d7b542..771e637 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -8,7 +8,7 @@ This is a single top-level namespace filled with packages. Each directory is pot ### Using asdf or rtx -We utilize a `.go-version` file that can be used by [asdf-vm](https://github.com/kennyp/asdf-golang) or [rtx](https://github.com/jdxcode/rtx) like so: +We utilize a `.tool-versions` file that can be used by [asdf-vm](https://github.com/kennyp/asdf-golang) or [rtx](https://github.com/jdxcode/rtx) like so: ```bash cd /path/to/sopstool/repository/ diff --git a/.github/.dependabot.yml b/.github/dependabot.yml similarity index 83% rename from .github/.dependabot.yml rename to .github/dependabot.yml index 9f6c58f..4e85f29 100644 --- a/.github/.dependabot.yml +++ b/.github/dependabot.yml @@ -4,6 +4,7 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: + # Check for updates to GitHub Actions every week interval: "weekly" # Maintain dependencies for go - package-ecosystem: "gomod" diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index fe36e12..990ff78 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -14,7 +14,7 @@ jobs: - uses: actions/setup-go@v4 with: go-version: "1.20" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 83d2b29..393d314 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,16 +18,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Fetch all tags run: git fetch --force --tags - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Set up Syft uses: anchore/sbom-action/download-syft@v0 @@ -40,24 +40,24 @@ jobs: run: go mod download && go build - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} aws-region: us-east-1 - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser version: latest diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 852541f..d4c9500 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,14 +15,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Fetch all tags run: git fetch --force --tags - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -37,7 +37,7 @@ jobs: run: go mod download && go build - name: Test & publish code coverage - uses: paambaati/codeclimate-action@v3.2.0 + uses: paambaati/codeclimate-action@v5 env: CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} with: @@ -45,7 +45,7 @@ jobs: prefix: github.com/Ibotta/sopstool - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser version: latest diff --git a/go.mod b/go.mod index afdacbf..adcf812 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,15 @@ module github.com/Ibotta/sopstool -go 1.19 +go 1.20 require ( github.com/golang/mock v1.6.0 github.com/mozilla-services/yaml v0.0.0-20201007153854-c369669a6625 - github.com/spf13/cobra v1.7.0 + github.com/spf13/cobra v1.8.0 ) require ( - github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect diff --git a/go.sum b/go.sum index c268966..57e2706 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -8,8 +8,8 @@ github.com/mozilla-services/yaml v0.0.0-20201007153854-c369669a6625 h1:5IeGQzguD github.com/mozilla-services/yaml v0.0.0-20201007153854-c369669a6625/go.mod h1:Is/Ucts/yU/mWyGR8yELRoO46mejouKsJfQLAIfTR18= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= diff --git a/oswrap/exec.go b/oswrap/exec.go index e60755a..e65f2a9 100644 --- a/oswrap/exec.go +++ b/oswrap/exec.go @@ -46,13 +46,12 @@ func (ew execWrap) RunCommandStdoutToFile(outfileName string, command []string) if err != nil { return err } + cmd.Stdout = outfile err = cmd.Start() if err != nil { - // todo defer? outfile.Close() - // todo defer? ow.Remove(outfileName) return err } @@ -63,7 +62,6 @@ func (ew execWrap) RunCommandStdoutToFile(outfileName string, command []string) return err } if ret != nil { - // todo defer? ow.Remove(outfileName) } diff --git a/scm/git.go b/scm/git.go index 8e87cc1..a5fd49e 100644 --- a/scm/git.go +++ b/scm/git.go @@ -48,9 +48,8 @@ func lineInFileExists(line string, filename string) (bool, error) { return false, nil } else if errors.Is(err, os.ErrPermission) { return false, fmt.Errorf("insufficient permissions to read %s file", filename) - } else { - return false, err } + return false, err } defer file.Close()