Skip to content

Commit

Permalink
ci: use Go 1.19 for builds, remove 1.16 support (peak#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
kucukaslan authored Aug 9, 2022
1 parent 7c90f8a commit 2a6c7cc
Show file tree
Hide file tree
Showing 32 changed files with 96 additions and 191 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.19.x
- 1.18.x
- 1.17.x
- 1.16.x
os:
- macos
- ubuntu
Expand All @@ -27,9 +27,9 @@ jobs:
strategy:
matrix:
go-version:
- 1.19.x
- 1.18.x
- 1.17.x
- 1.16.x
os:
- macos
- ubuntu
Expand All @@ -49,7 +49,7 @@ jobs:
strategy:
matrix:
go-version:
- 1.18.x
- 1.19.x
os:
- ubuntu

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
- Disable AWS SDK logger if log level is not `trace`. ([##460](https://github.com/peak/s5cmd/pull/460))
- Allow adjacent slashes to be used as keys when uploading to remote. ([#459](https://github.com/peak/s5cmd/pull/459))
- Debian packages are provided on [releases page](https://github.com/peak/s5cmd/releases) ([#380](https://github.com/peak/s5cmd/issues/380))
- Upgraded minimum required Go version to 1.17.


#### Bugfixes
- Fixed a bug where (`--stat`) prints unnecessarily when used with help and version commands ([#452](https://github.com/peak/s5cmd/issues/452))
Expand Down
2 changes: 1 addition & 1 deletion 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.19-alpine as build
COPY . /s5cmd/
RUN apk add --no-cache git make && \
cd /s5cmd/ && \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ ps. Quoted from [s5cmd feedstock](https://github.com/conda-forge/s5cmd-feedstoc
### Build from source
You can build `s5cmd` from source if you have [Go](https://golang.org/dl/) 1.16+
You can build `s5cmd` from source if you have [Go](https://golang.org/dl/) 1.17+
installed.
go get github.com/peak/s5cmd
Expand Down
3 changes: 1 addition & 2 deletions command/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"mime"
"net/http"
"os"
Expand Down Expand Up @@ -914,7 +913,7 @@ func guessContentType(file *os.File) string {
defer file.Seek(0, io.SeekStart)

const bufsize = 512
buf, err := ioutil.ReadAll(io.LimitReader(file, bufsize))
buf, err := io.ReadAll(io.LimitReader(file, bufsize))
if err != nil {
return ""
}
Expand Down
3 changes: 1 addition & 2 deletions command/cp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package command

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

Expand Down Expand Up @@ -46,7 +45,7 @@ func TestGuessContentType(t *testing.T) {
for _, tc := range testcases {
tc := tc

f, err := ioutil.TempFile("", tc.filename)
f, err := os.CreateTemp("", tc.filename)
if err != nil {
t.Error(err)
}
Expand Down
9 changes: 5 additions & 4 deletions command/sync_strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ func (s *SizeOnlyStrategy) ShouldSync(srcObj, dstObj *storage.Object) error {

// SizeAndModificationStrategy determines to sync based on objects' both sizes and modification times.
// It treats source object as the source-of-truth;
// time: src > dst size: src != dst should sync: yes
// time: src > dst size: src == dst should sync: yes
// time: src <= dst size: src != dst should sync: yes
// time: src <= dst size: src == dst should sync: no
//
// time: src > dst size: src != dst should sync: yes
// time: src > dst size: src == dst should sync: yes
// time: src <= dst size: src != dst should sync: yes
// time: src <= dst size: src == dst should sync: no
type SizeAndModificationStrategy struct{}

func (sm *SizeAndModificationStrategy) ShouldSync(srcObj, dstObj *storage.Object) error {
Expand Down
3 changes: 1 addition & 2 deletions e2e/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"math/rand"
"os"
"os/exec"
Expand Down Expand Up @@ -195,7 +194,7 @@ func s5cmd(workdir, endpoint string) func(args ...string) icmd.Cmd {
}

func goBuildS5cmd() func() {
tmpdir, err := ioutil.TempDir("", "")
tmpdir, err := os.MkdirTemp("", "")
if err != nil {
panic(err)
}
Expand Down
27 changes: 23 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
module github.com/peak/s5cmd

go 1.13
go 1.17

require (
github.com/aws/aws-sdk-go v1.40.25
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/go-cmp v0.4.0
github.com/hashicorp/go-multierror v1.0.0
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334
github.com/igungor/gofakes3 v0.0.11
github.com/karrick/godirwalk v1.15.3
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/kr/pretty v0.2.0 // indirect
github.com/posener/complete v1.2.3
github.com/stretchr/testify v1.4.0
github.com/termie/go-shutil v0.0.0-20140729215957-bcacb06fecae
github.com/urfave/cli/v2 v2.2.0
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gotest.tools/v3 v3.0.2
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/kr/pretty v0.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 // indirect
github.com/shabbyrobe/gocovmerge v0.0.0-20180507124511-f6ea450bfb63 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/stretchr/objx v0.1.0 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461 // indirect
golang.org/x/tools v0.0.0-20190624222133-a101b041ded4 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
)
13 changes: 7 additions & 6 deletions storage/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"math/rand"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -701,7 +700,7 @@ func TestS3CopyEncryptionRequest(t *testing.T) {

r.HTTPResponse = &http.Response{
StatusCode: http.StatusOK,
Body: ioutil.NopCloser(strings.NewReader("")),
Body: io.NopCloser(strings.NewReader("")),
}

params := r.Params
Expand Down Expand Up @@ -803,7 +802,7 @@ func TestS3PutEncryptionRequest(t *testing.T) {

r.HTTPResponse = &http.Response{
StatusCode: http.StatusOK,
Body: ioutil.NopCloser(strings.NewReader("")),
Body: io.NopCloser(strings.NewReader("")),
}

params := r.Params
Expand Down Expand Up @@ -896,7 +895,7 @@ func TestS3listObjectsV2(t *testing.T) {
mockApi.Handlers.Send.PushBack(func(r *request.Request) {
r.HTTPResponse = &http.Response{
StatusCode: http.StatusOK,
Body: ioutil.NopCloser(strings.NewReader("")),
Body: io.NopCloser(strings.NewReader("")),
}

r.Data = &s3.ListObjectsV2Output{
Expand Down Expand Up @@ -1128,7 +1127,7 @@ func TestSessionAutoRegion(t *testing.T) {
r.HTTPResponse = &http.Response{
StatusCode: tc.status,
Header: header,
Body: ioutil.NopCloser(strings.NewReader("")),
Body: io.NopCloser(strings.NewReader("")),
}
})

Expand Down Expand Up @@ -1260,7 +1259,9 @@ func valueAtPath(i interface{}, s string) interface{} {

// tempError is a wrapper error type that implements anonymous
// interface getting checked in url.Error.Temporary;
// interface { Temporary() bool }
//
// interface { Temporary() bool }
//
// see: https://github.com/golang/go/blob/2ebe77a2fda1ee9ff6fd9a3e08933ad1ebaea039/src/net/url/url.go#L38-L43
//
// AWS SDK checks if the underlying error in received url.Error implements it;
Expand Down
33 changes: 17 additions & 16 deletions storage/url/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,23 +226,24 @@ func (u *URL) remoteURL() string {
// prefix is the part that comes before the wildcard string.
//
// Example:
// key: a/b/test?/c/*.tsv
// prefix: a/b/test
// filter: ?/c/*
// regex: ^a/b/test./c/.*?\\.tsv$
// delimiter: ""
//
// key: a/b/test?/c/*.tsv
// prefix: a/b/test
// filter: ?/c/*
// regex: ^a/b/test./c/.*?\\.tsv$
// delimiter: ""
//
// It prepares delimiter, prefix and regex for regular strings.
// These are used in S3 listing operations.
// See: https://docs.aws.amazon.com/AmazonS3/latest/dev/ListingKeysHierarchy.html
//
// Example:
// key: a/b/c
// prefix: a/b/c
// filter: ""
// regex: ^a/b/c.*$
// delimiter: "/"
//
// key: a/b/c
// prefix: a/b/c
// filter: ""
// regex: ^a/b/c.*$
// delimiter: "/"
func (u *URL) setPrefixAndFilter() error {
if u.raw {
return nil
Expand Down Expand Up @@ -361,10 +362,10 @@ func (u *URL) IsWildcard() bool {
// wildcard part (filter)
//
// Example:
// key: a/b/test2/c/example_file.tsv
// prefix: a/b/
// output: test2/c/example_file.tsv
//
// key: a/b/test2/c/example_file.tsv
// prefix: a/b/
// output: test2/c/example_file.tsv
func parseBatch(prefix string, key string) string {
index := strings.LastIndex(prefix, s3Separator)
if index < 0 || !strings.HasPrefix(key, prefix) {
Expand All @@ -380,10 +381,10 @@ func parseBatch(prefix string, key string) string {
// path.
//
// Example:
// key: a/b/c/d
// prefix: a/b
// output: c/
//
// key: a/b/c/d
// prefix: a/b
// output: c/
func parseNonBatch(prefix string, key string) string {
if key == prefix || !strings.HasPrefix(key, prefix) {
return key
Expand Down
1 change: 0 additions & 1 deletion vendor/github.com/hashicorp/errwrap/go.mod

This file was deleted.

3 changes: 0 additions & 3 deletions vendor/github.com/hashicorp/go-multierror/go.mod

This file was deleted.

4 changes: 0 additions & 4 deletions vendor/github.com/hashicorp/go-multierror/go.sum

This file was deleted.

23 changes: 0 additions & 23 deletions vendor/github.com/igungor/gofakes3/go.mod

This file was deleted.

36 changes: 0 additions & 36 deletions vendor/github.com/igungor/gofakes3/go.sum

This file was deleted.

5 changes: 0 additions & 5 deletions vendor/github.com/jmespath/go-jmespath/go.mod

This file was deleted.

11 changes: 0 additions & 11 deletions vendor/github.com/jmespath/go-jmespath/go.sum

This file was deleted.

3 changes: 0 additions & 3 deletions vendor/github.com/karrick/godirwalk/go.mod

This file was deleted.

Empty file.
8 changes: 0 additions & 8 deletions vendor/github.com/posener/complete/go.mod

This file was deleted.

Loading

0 comments on commit 2a6c7cc

Please sign in to comment.