From d41c34fd8413a955082e41e7ccf7cedf0e8faab6 Mon Sep 17 00:00:00 2001 From: pacoorozco Date: Wed, 14 Dec 2022 18:11:56 +0100 Subject: [PATCH 1/3] Update GHA to latest versions Signed-off-by: pacoorozco --- .github/workflows/create-release.yml | 8 ++++---- .github/workflows/lint.yml | 14 ++++++++------ .github/workflows/test.yml | 14 +++++--------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 61caad0..03cf937 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -9,15 +9,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v4 with: version: latest args: release --rm-dist diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3ab3a92..5b91db1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,16 +13,18 @@ jobs: name: Linter code runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 + - uses: actions/setup-go@v3 + with: + go-version: '~1.19' + - uses: actions/checkout@v3 - name: Cache Go modules - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - - name: Run linter - uses: golangci/golangci-lint-action@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 with: - version: v1.45 + version: v1.50.1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c43c3e6..974fca8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,29 +8,25 @@ jobs: test-matrix: strategy: matrix: - go-version: [1.17.x, 1.18.x] + go-version: [1.18.x, 1.19.x] os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - - name: Install Go - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - name: Cache Go modules - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build binary run: make build - name: Run tests run: make test - name: Send code coverage - uses: codecov/codecov-action@v1 - if: matrix.os == 'ubuntu-latest' - with: - fail_ci_if_error: true + uses: codecov/codecov-action@v3 From 1dcfc2370b23ce149e881843aedc0e4dd4ffaa66 Mon Sep 17 00:00:00 2001 From: pacoorozco Date: Wed, 14 Dec 2022 18:28:41 +0100 Subject: [PATCH 2/3] Upgrade supported versions of Go Signed-off-by: pacoorozco --- CHANGELOG.md | 6 ++++ Makefile | 4 +-- go.mod | 54 +++++++++++++++++++++++++----------- go.sum | 12 +++----- internal/cmd/version_test.go | 4 +-- internal/config/config.go | 2 +- 6 files changed, 53 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d42fa13..fe00f6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/). +## 3.5.0 +### Added +- Support for the latest published Go version (1.19). This project will maintain compatibility with the latest two major versions published. +### Removed +- Once Go 1.19 has been published, previous Go 1.17 support is deprecated. + ## 3.4.0 ### Changed - The command `auth` initiates the [Google authentication to get an OAuth 2.0 token](https://gphotosuploader.github.io/gphotos-uploader-cli/#/getting-started?id=authentication). **It should be used the first time that the CLI is configured**. See [documentation](https://gphotosuploader.github.io/gphotos-uploader-cli/#/getting-started?id=authentication). diff --git a/Makefile b/Makefile index 61f7718..05ba697 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ TMP_DIR ?= .tmp COVERAGE_FILE := $(TMP_DIR)/coverage.txt COVERAGE_HTML_FILE := $(TMP_DIR)/coverage.html GOLANGCI := $(TMP_DIR)/golangci-lint -GOLANGCI_VERSION := 1.45 +GOLANGCI_VERSION := 1.50.1 # set how to open files based on OS and ARCH. UNAME_OS := $(shell uname -s) @@ -63,7 +63,7 @@ clean: ## Clean all built artifacts $(GOLANGCI): @echo "--> Installing golangci v$(GOLANGCI_VERSION)..." @mkdir -p $(dir $(GOLANGCI)) - @curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(dir $(GOLANGCI)) v$(GOLANGCI_VERSION) + @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(dir $(GOLANGCI)) v$(GOLANGCI_VERSION) .PHONY: lint lint: $(GOLANGCI) ## Run linter diff --git a/go.mod b/go.mod index 8c1508e..3b039d5 100644 --- a/go.mod +++ b/go.mod @@ -1,25 +1,15 @@ module github.com/gphotosuploader/gphotos-uploader-cli -go 1.16 +go 1.18 require ( github.com/99designs/keyring v1.2.1 github.com/bmatcuk/doublestar/v2 v2.0.4 - github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect - github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect - github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect github.com/facebookgo/symwalk v0.0.0-20150726040526-42004b9f3222 - github.com/facebookgo/testname v0.0.0-20150612200628-5443337c3a12 // indirect - github.com/gadelkareem/cachita v0.2.3 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/gphotosuploader/google-photos-api-client-go/v2 v2.3.0 - github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-retryablehttp v0.7.0 // indirect - github.com/hjson/hjson-go v3.1.0+incompatible + github.com/gphotosuploader/google-photos-api-client-go/v2 v2.4.0 + github.com/hjson/hjson-go/v4 v4.3.0 github.com/int128/oauth2cli v1.14.0 github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213 - github.com/mattn/go-colorable v0.1.12 // indirect - github.com/mediocregopher/radix/v3 v3.8.0 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d github.com/mitchellh/go-homedir v1.1.0 github.com/pierrec/xxHash v0.1.5 @@ -29,12 +19,44 @@ require ( github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 github.com/syndtr/goleveldb v1.0.0 - github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect - golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 // indirect golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 +) + +require ( + cloud.google.com/go/compute v1.5.0 // indirect + github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect + github.com/danieljoos/wincred v1.1.2 // indirect + github.com/dvsekhvalnov/jose2go v1.5.0 // indirect + github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect + github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect + github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect + github.com/facebookgo/testname v0.0.0-20150612200628-5443337c3a12 // indirect + github.com/gadelkareem/cachita v0.2.3 // indirect + github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/gphotosuploader/googlemirror v0.5.0 // indirect + github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-retryablehttp v0.7.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/int128/listener v1.1.0 // indirect + github.com/mattn/go-colorable v0.1.12 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.13 // indirect + github.com/mediocregopher/radix/v3 v3.8.0 // indirect + github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect + github.com/mtibben/percent v0.2.1 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect + golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 // indirect + golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect + golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/api v0.74.0 // indirect + google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.28.0 // indirect ) diff --git a/go.sum b/go.sum index a6ef90e..4e3cb3c 100644 --- a/go.sum +++ b/go.sum @@ -28,7 +28,6 @@ cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+Y cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= @@ -197,8 +196,8 @@ github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/Oth github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gphotosuploader/google-photos-api-client-go/v2 v2.3.0 h1:r8Ep/A+u90QPBWkxzUn26V3S6MCQckgQ+A3jM1Lzvhk= -github.com/gphotosuploader/google-photos-api-client-go/v2 v2.3.0/go.mod h1:gqiTywgpxqdJPaCEPyyqq5QIWnJm8PdY+VncY2uw9qk= +github.com/gphotosuploader/google-photos-api-client-go/v2 v2.4.0 h1:Y1pBIq1CYEoxsxZG4N9ayJYT8YIq5jIEhlPorSsXjc4= +github.com/gphotosuploader/google-photos-api-client-go/v2 v2.4.0/go.mod h1:eqEDHXjpGGAIX72a7XlTQxmJQYcCiYOn2zelMUcdRBg= github.com/gphotosuploader/googlemirror v0.5.0 h1:9a9CCUnAFo3qHp7U/epmdTiOvAzXCkVq5AQLo8PWBns= github.com/gphotosuploader/googlemirror v0.5.0/go.mod h1:L6A+2KW6d/OwjZ5QH2fGXJXsOtR115tj9w+YxdyjfUI= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= @@ -214,8 +213,8 @@ github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiw github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hjson/hjson-go v3.1.0+incompatible h1:DY/9yE8ey8Zv22bY+mHV1uk2yRy0h8tKhZ77hEdi0Aw= -github.com/hjson/hjson-go v3.1.0+incompatible/go.mod h1:qsetwF8NlsTsOTwZTApNlTCerV+b2GjYRRcIk4JMFio= +github.com/hjson/hjson-go/v4 v4.3.0 h1:dyrzJdqqFGhHt+FSrs5n9s6b0fPM8oSJdWo+oS3YnJw= +github.com/hjson/hjson-go/v4 v4.3.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEFTse3rH13E= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -292,7 +291,6 @@ 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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= -github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -495,7 +493,6 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -748,7 +745,6 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 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 h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/cmd/version_test.go b/internal/cmd/version_test.go index 86974bf..67a948a 100644 --- a/internal/cmd/version_test.go +++ b/internal/cmd/version_test.go @@ -2,7 +2,7 @@ package cmd_test import ( "bytes" - "io/ioutil" + "io" "testing" "github.com/gphotosuploader/gphotos-uploader-cli/internal/cmd" @@ -15,7 +15,7 @@ func TestNewVersionCmd(t *testing.T) { if err := c.Execute(); err != nil { t.Fatal(err) } - got, err := ioutil.ReadAll(b) + got, err := io.ReadAll(b) if err != nil { t.Fatal(err) } diff --git a/internal/config/config.go b/internal/config/config.go index 1464517..7fd587e 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -8,7 +8,7 @@ import ( "io" "path/filepath" - "github.com/hjson/hjson-go" + "github.com/hjson/hjson-go/v4" "github.com/mitchellh/go-homedir" "github.com/spf13/afero" ) From 9a62af98c4d77b34833d7556d15961f5b510f648 Mon Sep 17 00:00:00 2001 From: pacoorozco Date: Wed, 14 Dec 2022 18:32:35 +0100 Subject: [PATCH 3/3] Update CHANGELOG Signed-off-by: pacoorozco --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe00f6e..dcef911 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/) and this ## 3.5.0 ### Added - Support for the latest published Go version (1.19). This project will maintain compatibility with the latest two major versions published. +### Fix +- Exit if daily API quota is exceeded. Thanks to [@mlbright](https://github.com/mlbright) ([#341][i341]) ### Removed - Once Go 1.19 has been published, previous Go 1.17 support is deprecated. +[i341]: https://github.com/gphotosuploader/gphotos-uploader-cli/pull/341 + ## 3.4.0 ### Changed - The command `auth` initiates the [Google authentication to get an OAuth 2.0 token](https://gphotosuploader.github.io/gphotos-uploader-cli/#/getting-started?id=authentication). **It should be used the first time that the CLI is configured**. See [documentation](https://gphotosuploader.github.io/gphotos-uploader-cli/#/getting-started?id=authentication).