diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5063f83..27b3b65 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,27 +35,29 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: 1.18 + go-version: "~1.22.8" - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Lint Go Code - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: - version: v1.50.1 + version: v1.57.2 + args: --timeout=30m + install-mode: binary - name: Run Unit tests. run: go test ./... - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v6 with: - version: latest + version: "2.0.1" args: build --snapshot --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d42da9d..63466f4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,19 +33,21 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: 1.18 + go-version: "~1.22.8" - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Lint Go Code - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v6 with: - version: v1.50.1 + version: v1.57.2 + args: --timeout=30m + install-mode: binary - name: Run Unit tests. run: go test ./... @@ -57,9 +59,9 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v6 with: - version: latest + version: "2.0.1" args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.golangci.yml b/.golangci.yml index 69fd717..210daac 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -47,6 +47,8 @@ linters: - ifshort - golint - deadcode + - depguard + - tagalign linters-settings: lll: diff --git a/.goreleaser.yml b/.goreleaser.yml index 3c1dc51..5ca039a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -20,6 +20,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +project_name: xk6bundler +version: 2 + before: hooks: - go mod download diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser index 68b6b8c..d9e155a 100644 --- a/Dockerfile.goreleaser +++ b/Dockerfile.goreleaser @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -FROM golang:1.20.7-bullseye +FROM golang:1.22.8-bullseye COPY xk6bundler /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/ diff --git a/cmd/xk6bundler/build.go b/cmd/xk6bundler/build.go index 03895d9..c9c7e17 100644 --- a/cmd/xk6bundler/build.go +++ b/cmd/xk6bundler/build.go @@ -29,7 +29,6 @@ import ( "context" _ "embed" "io" - "io/ioutil" "os" "path/filepath" "text/template" @@ -107,7 +106,7 @@ func createDockerfile(output string) error { const fileMode = 0o644 - return ioutil.WriteFile(name, []byte(str), fileMode) + return os.WriteFile(name, []byte(str), fileMode) } func createArchive(archive string, output string) error { diff --git a/cmd/xk6bundler/options.go b/cmd/xk6bundler/options.go index 3a3abce..ce5add3 100644 --- a/cmd/xk6bundler/options.go +++ b/cmd/xk6bundler/options.go @@ -242,6 +242,7 @@ func splitWith(arg string) (module, version, replace string, err error) { } else { version = parts[1] parts := strings.SplitN(version, replaceSplit, versionParts) + if len(parts) > 1 { version = parts[0] replace = parts[1] diff --git a/go.mod b/go.mod index 592d8df..538c427 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/szkiba/xk6bundler -go 1.18 +go 1.22 require ( github.com/go-task/slim-sprig v2.20.0+incompatible github.com/jessevdk/go-flags v1.5.0 gitlab.com/golang-commonmark/markdown v0.0.0-20211110145824-bf3e522c626a - go.k6.io/xk6 v0.9.0 + go.k6.io/xk6 v0.13.0 gopkg.in/ini.v1 v1.67.0 ) diff --git a/go.sum b/go.sum index 2f4c492..9007900 100644 --- a/go.sum +++ b/go.sum @@ -41,8 +41,8 @@ gitlab.com/golang-commonmark/puny v0.0.0-20191124015043-9f83538fa04f h1:Wku8eEde gitlab.com/golang-commonmark/puny v0.0.0-20191124015043-9f83538fa04f/go.mod h1:Tiuhl+njh/JIg0uS/sOJVYi0x2HEa5rc1OAaVsb5tAs= gitlab.com/opennota/wd v0.0.0-20180912061657-c5d65f63c638 h1:uPZaMiz6Sz0PZs3IZJWpU5qHKGNy///1pacZC9txiUI= gitlab.com/opennota/wd v0.0.0-20180912061657-c5d65f63c638/go.mod h1:EGRJaqe2eO9XGmFtQCvV3Lm9NLico3UhFwUpCG/+mVU= -go.k6.io/xk6 v0.9.0 h1:6ihaW4Qsi+Lh3FB6PWwg6Qq+Z6uf4wnkib90smsMTGs= -go.k6.io/xk6 v0.9.0/go.mod h1:4+BwjriwZ52roJ9RHHQhTBb9Q6ZctEUtsCO10H8rJIo= +go.k6.io/xk6 v0.13.0 h1:DY6xgBdf1BFwyDVPuFgJTYVaXc9KMuC9ioCKBi1HZVg= +go.k6.io/xk6 v0.13.0/go.mod h1:4+BwjriwZ52roJ9RHHQhTBb9Q6ZctEUtsCO10H8rJIo= golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=