Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GoLang to 1.20 & dependency updates #229

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-release-action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: action-ci
on:
on:
pull_request:

jobs:
Expand All @@ -9,10 +9,10 @@ jobs:
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
# fetch all tags
fetch-depth: 0
- name: build docker image
run: docker build ./actions/release
run: docker build ./actions/release
33 changes: 15 additions & 18 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Go CI
on:
on:
push:
branches:
- "**"
Expand All @@ -12,38 +12,35 @@ jobs:
build:
strategy:
matrix:
os:
os:
- ubuntu-latest
arch:
- amd64
- arm
- arm64
go-version: [1.17.5]
go-version: [ '1.20' ]
include:
- os: macos-latest
arch: amd64
go-version: 1.17.5
go-version: '1.20'
- os: macos-latest
arch: arm64
go-version: 1.17.5
go-version: '1.20'
name: Build
runs-on: ${{ matrix.os }}
steps:
- name: hello world
run: echo hello world

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
# fetch all tags
fetch-depth: 0
fetch-depth: 0

- name: Map binary name
id: binary
Expand All @@ -62,23 +59,23 @@ jobs:
run: |
GOARCH=${{ matrix.arch }} go build -v -ldflags "-X github.com/whalebrew/whalebrew/version.Version=$(git describe --always --tags --dirty)" -o ${{ steps.binary.outputs.binary_name }} .


- name: Ensure binary works
run: ./${{ steps.binary.outputs.binary_name }} version
if: ${{ !startsWith(matrix.arch, 'arm') }}

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.binary.outputs.binary_name }}
path: whalebrew-*

- name: run tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...

- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} #required

release:
name: release
runs-on: ubuntu-latest
Expand All @@ -87,17 +84,17 @@ jobs:
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
# fetch all tags
fetch-depth: 0

- name: Download assets
id: download
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: release/artifacts

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/build
/.whalebrew-tests
.idea/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: go
go:
- 1.12
- "1.20"
install:
- go get -u golang.org/x/lint/golint
- go get golang.org/x/tools/cmd/goimports
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG GO_VERSION=1.12
ARG DOCKER_VERSION=18.06
ARG GO_VERSION=1.20
ARG DOCKER_VERSION=24.0.2

FROM docker:${DOCKER_VERSION} as docker-cli
FROM golang:${GO_VERSION}-alpine as go
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ Those hooks must be executable files located in `${WHALEBREW_CONFIG_DIR}/hooks`.

Whalebrew supports the following hooks:

|command & arguments|description|
|-|-|
|`pre-install ${DOCKER_IMAGE} ${EXECUTABLE_NAME}`|This hook is called before installing a package. If it fails, the whole installation process fails|
|`post-install ${EXECUTABLE_NAME}`|This hook is called after a package is installed. If it fails, the installation process fails, but the package is not uninstalled|
|`pre-uninstall ${EXECUTABLE_NAME}`|This hook is called before uninstalling a package. If it fails, the whole uninstallation process fails|
|`post-uninstall ${EXECUTABLE_NAME}`|This hook is called after a package is uninstalled. If it fails, the uninstallation process fails, but the package is not uninstalled|
| command & arguments | description |
|--------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| `pre-install ${DOCKER_IMAGE} ${EXECUTABLE_NAME}` | This hook is called before installing a package. If it fails, the whole installation process fails |
| `post-install ${EXECUTABLE_NAME}` | This hook is called after a package is installed. If it fails, the installation process fails, but the package is not uninstalled |
| `pre-uninstall ${EXECUTABLE_NAME}` | This hook is called before uninstalling a package. If it fails, the whole uninstallation process fails |
| `post-uninstall ${EXECUTABLE_NAME}` | This hook is called after a package is uninstalled. If it fails, the uninstallation process fails, but the package is not uninstalled |

### Whalebrew images

Expand Down
4 changes: 2 additions & 2 deletions actions/release/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18-alpine as build
FROM golang:1.20-alpine as build
RUN apk add --no-cache git build-base
RUN mkdir /src
WORKDIR /src
Expand All @@ -12,4 +12,4 @@ RUN go test -v ./...

FROM alpine
COPY --from=build /bin/release /bin/release
ENTRYPOINT ["/bin/release"]
ENTRYPOINT ["/bin/release"]
2 changes: 1 addition & 1 deletion actions/release/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/whalebrew/whalebrew/actions/release

go 1.17
go 1.20

require (
github.com/actions-go/toolkit v0.0.0-20220207230919-2c5a93c4f459
Expand Down
13 changes: 13 additions & 0 deletions actions/release/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/actions-go/toolkit v0.0.0-20220207230919-2c5a93c4f459 h1:9xvkwBmqAn4uIEOifdf8c0x/z9WTu5iQ9Wk2eZRVWiU=
github.com/actions-go/toolkit v0.0.0-20220207230919-2c5a93c4f459/go.mod h1:SPTBtjaZ87R+frsWISW1oUaLpRAZsbPzxhMy4Z8jo0A=
github.com/bradleyfalzon/ghinstallation/v2 v2.0.3/go.mod h1:tlgi+JWCXnKFx/Y4WtnDbZEINo31N5bcvnCoqieefmk=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
Expand All @@ -50,6 +52,7 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down Expand Up @@ -89,6 +92,8 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-github/v39 v39.0.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE=
github.com/google/go-github/v42 v42.0.0 h1:YNT0FwjPrEysRkLIiKuEfSvBPCGKphW5aS5PxwaoLec=
github.com/google/go-github/v42 v42.0.0/go.mod h1:jgg/jvyI0YlDOM1/ps6XYh04HNQ3vKf0CVko62/EhRg=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
Expand All @@ -103,6 +108,7 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
Expand Down Expand Up @@ -195,6 +201,7 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -237,11 +244,17 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
3 changes: 1 addition & 2 deletions actions/release/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"
"hash"
"io"
"io/ioutil"
"mime"
"os"
"path/filepath"
Expand Down Expand Up @@ -83,7 +82,7 @@ func uploadAsset(name string, release *github.RepositoryRelease, path string) er
if err != nil {
return err
}
tmpfile, err := ioutil.TempFile("", "checksum*"+ext)
tmpfile, err := os.CreateTemp("", "checksum*"+ext)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions actions/release/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"io/ioutil"
"io"
"os"
"testing"

Expand All @@ -26,9 +26,9 @@ func TestUploadAssetSucceeds(t *testing.T) {
"hello-world.sha1": "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83",
"hello-world.sha256": "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2",
}
openedFiles := []*os.File{}
var openedFiles []*os.File
uploadReleaseAsset = func(name, label string, release *github.RepositoryRelease, fd *os.File) error {
b, err := ioutil.ReadAll(fd)
b, err := io.ReadAll(fd)
assert.NoError(t, err)
assert.Equal(t, contents[name], string(b))
delete(contents, name)
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewClient() (*Client, error) {
}, nil
}

func(c *Client) ImageInspect(ctx context.Context, imageName string) (*types.ImageInspect, error) {
func (c *Client) ImageInspect(ctx context.Context, imageName string) (*types.ImageInspect, error) {
imageInspect, _, err := c.ImageInspectWithRaw(ctx, imageName)
if err == nil {
return &imageInspect, nil
Expand Down
8 changes: 4 additions & 4 deletions cmd/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import (
"path"
"syscall"

"github.com/whalebrew/whalebrew/packages"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/whalebrew/whalebrew/packages"
)

func init() {
RootCmd.AddCommand(editCommand)
}

var editCommand = &cobra.Command{
Use: "edit PACKAGENAME",
Short: "Edit a package file",
Long: "Edit a package file using your default editor ($EDITOR).",
Use: "edit PACKAGENAME",
Short: "Edit a package file",
Long: "Edit a package file using your default editor ($EDITOR).",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return cmd.Help()
Expand Down
8 changes: 4 additions & 4 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var installCommand = &cobra.Command{
return cmd.Help()
}
if len(args) > 1 {
return fmt.Errorf("Only one image can be installed at a time")
return fmt.Errorf("only one image can be installed at a time")
}

imageName := args[0]
Expand Down Expand Up @@ -114,15 +114,15 @@ var installCommand = &cobra.Command{
fmt.Println(diff)

if !prompter.YN("Are you sure you would like to overwrite these changes?", false) {
return fmt.Errorf("Not installing package")
return fmt.Errorf("not installing package")
}
} else if pkg.Image == installed.Image {
fmt.Printf("%s would generate the same package, nothing to do\n", pkg.Image)
return nil
}

if pkg.Image != installed.Image && !prompter.YN(fmt.Sprintf("Would you like to change %s to %s?", installed.Image, pkg.Image), true) {
return fmt.Errorf("Not installing package")
return fmt.Errorf("not installing package")
}
}
forceInstall = true
Expand All @@ -133,7 +133,7 @@ var installCommand = &cobra.Command{
fmt.Println(preinstallMessage)
if !assumeYes {
if !prompter.YN("Is this okay?", true) {
return fmt.Errorf("Not installing package")
return fmt.Errorf("not installing package")
}
}
}
Expand Down
Loading