Ibotta / sopstool

SOPS multi-file wrapper
Apache License 2.0
38 stars 4 forks source link

Add arm64 support for M1 Mac, replace golint #46

Closed physik932 closed 2 years ago

physik932 commented 2 years ago

Background

sopstool currently doesn't have support for Mac M1 laptops (darwin-arm64). sops latest 3.7.2 version adds support for the architecture. I'm adding it as an option to goreleaser but ran into some new things:

gomock 1.6.0 breaking change

gomock added ARM support in 1.6.0 but introduced a breaking change to DoAndReturn. It only takes one argument now instead of supporting any number of them (TIL this is what variadic means). I've removed args ...string from these functions to get tests to pass for now, but I'm new to golang and unsure of the consequences. I'm doing a bit of reading to make sure I understand what this means.

golint deprecated

golint appears deprecated and was not installed on my machine when I built the project using go 1.17. I haven't found a replacement yet but a few popped up:

go-version file

I added a .go-version file for the current version of the project. It is recognized by goenv and asdf-vm.

asdf-vm plugin for sopstool

@elementalvoid owns the asdf-vm plugin for sopstool; we will need to introduce a PR there to work with darwin-arm64 packages and update the error message.

Versioning

0.5.0

Additional Requests to Reviewers

Looking for any help on linters, testing the breaking change, and testing arm64 support.

Tasks

/cc

elementalvoid commented 2 years ago

@physik932 -- I've created https://github.com/elementalvoid/asdf-sopstool/pull/1 to get ready for the asdf plugin update. I am not positive what the release file name will look like but this is the basics. Once we have a release here we can ensure the plugin update works!

https://github.com/elementalvoid/asdf-sopstool/pull/1

physik932 commented 2 years ago

Looks like we're good to go!

❯ go build
❯ go fmt ./...
❯ go test ./...
?       github.com/Ibotta/sopstool      [no test files]
?       github.com/Ibotta/sopstool/cmd  [no test files]
ok      github.com/Ibotta/sopstool/filecrypt    (cached)
ok      github.com/Ibotta/sopstool/fileutil     (cached)
ok      github.com/Ibotta/sopstool/oswrap       (cached)
?       github.com/Ibotta/sopstool/oswrap/mock  [no test files]
ok      github.com/Ibotta/sopstool/sopsyaml     (cached)
?       github.com/Ibotta/sopstool/testhelpers  [no test files]
❯ golangci-lint run
❯ goreleaser release --snapshot --rm-dist --skip-publish
   • releasing...     
   • loading config file       file=.goreleaser.yml
   • loading environment variables
   • getting and validating git state
      • building...               commit=a616f92238e93190772106e7106f6196ddad6dc7 latest tag=v0.4.4
      • pipe skipped              error=disabled during snapshot mode
   • parsing tag      
   • setting defaults 
   • snapshotting     
      • building snapshot...      version=0.4.4-SNAPSHOT-a616f92
   • checking distribution directory
      • --rm-dist is set, cleaning it up
   • loading go mod information
   • build prerequisites
   • writing effective config file
      • writing                   config=dist/config.yaml
   • building binaries
      • building                  binary=dist/sopstool_linux_arm64/sopstool
      • building                  binary=dist/sopstool_darwin_arm64/sopstool
      • building                  binary=dist/sopstool_linux_amd64/sopstool
      • building                  binary=dist/sopstool_darwin_amd64/sopstool
   • archives         
      • creating                  archive=dist/sopstool_darwin_amd64.tar.gz
      • creating                  archive=dist/sopstool_darwin_arm64.tar.gz
      • creating                  archive=dist/sopstool_linux_amd64.tar.gz
      • creating                  archive=dist/sopstool_linux_arm64.tar.gz
   • linux packages   
      • creating                  arch=amd64 file=dist/sopstool_linux_amd64.rpm format=rpm package=sopstool
      • creating                  arch=amd64 file=dist/sopstool_linux_amd64.deb format=deb package=sopstool
      • creating                  arch=arm64 file=dist/sopstool_linux_arm64.rpm format=rpm package=sopstool
      • creating                  arch=arm64 file=dist/sopstool_linux_arm64.deb format=deb package=sopstool
   • homebrew tap formula
      • writing                   formula=dist/sopstool.rb
   • calculating checksums
   • docker images    
      • building docker image     image=ibotta/sopstool:latest
      • pipe skipped              error=publishing is disabled
   • storing release metadata
      • writing                   file=dist/artifacts.json
      • writing                   file=dist/metadata.json
   • release succeeded after 7.82s
physik932 commented 2 years ago

After some discussion with @onyxraven I filed two issues for the future: