Skip to content

Commit

Permalink
Go updated up to 1.20, module name changed
Browse files Browse the repository at this point in the history
  • Loading branch information
tarampampam committed Feb 23, 2023
1 parent 521d829 commit d0c8c74
Show file tree
Hide file tree
Showing 25 changed files with 92 additions and 102 deletions.
18 changes: 8 additions & 10 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.editorconfig
.git
.github
.idea
.vscode
temp
tmp
LICENSE
Makefile
tinifier
## Ignore everything
*

## Except the following files and directories
!/cmd
!/internal
!/pkg
!/go.*
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# EditorConfig docs: <https://editorconfig.org/>

root = true

[*]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
docker-hub-description:
name: Docker Hub Description
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
build:
name: Build for ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand All @@ -19,11 +19,11 @@ jobs:
- os: windows
arch: 386
steps:
- uses: actions/setup-go@v3
with: {go-version: 1.19}

- uses: actions/checkout@v3

- uses: gacts/setup-go-with-cache@v1
with: {go-version-file: go.mod}

- {uses: gacts/github-slug@v1, id: slug}

- name: Generate builder values
Expand All @@ -35,7 +35,7 @@ jobs:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
LDFLAGS: -s -w -X github.com/tarampampam/tinifier/v4/internal/version.version=${{ steps.slug.outputs.version }}
LDFLAGS: -s -w -X gh.tarampamp.am/tinifier/v4/internal/version.version=${{ steps.slug.outputs.version }}
run: go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/tinifier/

- uses: svenstaro/upload-release-action@v2
Expand All @@ -47,7 +47,7 @@ jobs:

docker:
name: Build docker image
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
godocs:
name: Renew docs and cache (${{ matrix.proxy }})
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand All @@ -93,14 +93,11 @@ jobs:
- https://goproxy.dev
steps:
- uses: actions/setup-go@v3
with: {go-version: 1.19}

- {uses: gacts/github-slug@v1, id: slug}

- run: go mod init example

- name: Get the module using proxy
env:
GO111MODULE: on
GOPROXY: ${{ matrix.proxy }}
run: go get -v -x -u "github.com/tarampampam/tinifier/v4@${{ steps.slug.outputs.tag-name }}"
env: {GOPROXY: '${{ matrix.proxy }}'}
run: go get -v -x -u "gh.tarampamp.am/tinifier/v4@${{ steps.slug.outputs.tag-name }}"
47 changes: 14 additions & 33 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
jobs:
gitleaks:
name: Gitleaks
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with: {fetch-depth: 0}
Expand All @@ -24,34 +24,25 @@ jobs:

golangci-lint:
name: Golang-CI (lint)
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v3
- uses: gacts/setup-go-with-cache@v1
with: {go-version: 1.19}

- uses: golangci/golangci-lint-action@v3
- uses: golangci/golangci-lint-action@v3 # Action page: <https://github.com/golangci/golangci-lint-action>
with: {skip-pkg-cache: true, skip-build-cache: true}

go-test:
name: Unit tests
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with: {go-version: 1.19}

- uses: actions/checkout@v3
with: {fetch-depth: 2} # Fixes codecov error 'Issue detecting commit SHA'

- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- run: go mod download
- uses: gacts/setup-go-with-cache@v1
with: {go-version-file: go.mod}

- run: go test -race -covermode=atomic -coverprofile /tmp/coverage.txt ./...

Expand All @@ -64,7 +55,7 @@ jobs:

build:
name: Build for ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand All @@ -75,29 +66,19 @@ jobs:
arch: 386
needs: [golangci-lint, go-test]
steps:
- uses: actions/setup-go@v3
with: {go-version: 1.19}

- uses: actions/checkout@v3

- {uses: gacts/github-slug@v1, id: slug}
- uses: gacts/setup-go-with-cache@v1
with: {go-version-file: go.mod}

- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-

- run: go mod download
- {uses: gacts/github-slug@v1, id: slug}

- name: Build application
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
LDFLAGS: -s -w -X github.com/tarampampam/tinifier/v4/internal/version.version=${{ steps.slug.outputs.branch-name-slug }}@${{ steps.slug.outputs.commit-hash-short }}
LDFLAGS: -s -w -X gh.tarampamp.am/tinifier/v4/internal/version.version=${{ steps.slug.outputs.branch-name-slug }}@${{ steps.slug.outputs.commit-hash-short }}
run: go build -trimpath -ldflags "$LDFLAGS" -o /tmp/tinifier ./cmd/tinifier/

- name: Try to execute
Expand All @@ -113,7 +94,7 @@ jobs:

image:
name: Build docker image
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: [golangci-lint, go-test]
steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].

## v4.1.0

### Changed

- Go dependencies updated
- Go version updated from `1.19` up to `1.20`
- Module name changed from `github.com/tarampampam/tinifier/v4` to `gh.tarampamp.am/tinifier/v4`

## v4.0.1

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1.2

# Image page: <https://hub.docker.com/_/golang>
FROM golang:1.19-alpine as builder
FROM golang:1.20-alpine as builder

# can be passed with any prefix (like `v1.2.3@GITHASH`)
# e.g.: `docker build --build-arg "APP_VERSION=v1.2.3@GITHASH" .`
Expand All @@ -17,7 +17,7 @@ WORKDIR /src
COPY . .

# arguments to pass on each go tool link invocation
ENV LDFLAGS="-s -w -X github.com/tarampampam/tinifier/v4/internal/version.version=$APP_VERSION"
ENV LDFLAGS="-s -w -X gh.tarampamp.am/tinifier/v4/internal/version.version=$APP_VERSION"

RUN set -x \
&& go version \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Makefile readme (en): <https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents>

SHELL = /bin/sh
LDFLAGS = "-s -w -X github.com/tarampampam/tinifier/v4/internal/version.version=$(shell git rev-parse HEAD)"
LDFLAGS = "-s -w -X gh.tarampamp.am/tinifier/v4/internal/version.version=$(shell git rev-parse HEAD)"

DC_RUN_ARGS = --rm --user "$(shell id -u):$(shell id -g)"
APP_NAME = $(notdir $(CURDIR))
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Download the latest binary file for your os/arch from [releases page][link_relea
Install the API client with `go get`:

```bash
$ go get -u github.com/tarampampam/tinifier/v4
$ go get -u gh.tarampamp.am/tinifier/v4
```

Client sources and usage examples can be found in [`pkg/tinypng`](pkg/tinypng) directory.
Expand Down Expand Up @@ -143,7 +143,7 @@ This is open-sourced software licensed under the [MIT License][link_license].
[link_golang]:https://golang.org/
[link_goreport]:https://goreportcard.com/report/github.com/tarampampam/tinifier
[link_coverage]:https://codecov.io/gh/tarampampam/tinifier
[link_gopkg]:https://pkg.go.dev/github.com/tarampampam/tinifier/v4
[link_gopkg]:https://pkg.go.dev/gh.tarampamp.am/tinifier/v4
[link_actions]:https://github.com/tarampampam/tinifier/actions
[link_docker_hub]:https://hub.docker.com/r/tarampampam/tinifier/
[link_ghcr]:https://github.com/users/tarampampam/packages/container/package/tinifier
Expand Down
2 changes: 1 addition & 1 deletion cmd/tinifier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/joho/godotenv"
"github.com/pkg/errors"

"github.com/tarampampam/tinifier/v4/internal/cli"
"gh.tarampamp.am/tinifier/v4/internal/cli"
)

// exitFn is a function for application exiting.
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ volumes:

services:
app:
image: golang:1.19-buster # Image page: <https://hub.docker.com/_/golang>
image: golang:1.20-buster # Image page: <https://hub.docker.com/_/golang>
working_dir: /src
environment:
HOME: /tmp
Expand All @@ -17,6 +17,7 @@ services:
- /etc/group:/etc/group:ro
- .:/src:cached
- tmp-data:/tmp:cached
security_opt: [no-new-privileges:true]

golint:
image: golangci/golangci-lint:v1.51-alpine # Image page: <https://hub.docker.com/r/golangci/golangci-lint>
Expand All @@ -27,3 +28,4 @@ services:
- golint-go:/go:rw # go dependencies will be downloaded on each run without this
- golint-cache:/tmp/golint:rw
working_dir: /src
security_opt: [no-new-privileges:true]
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
module github.com/tarampampam/tinifier/v4
module gh.tarampamp.am/tinifier/v4

go 1.19
go 1.20

require (
github.com/dustin/go-humanize v1.0.1
github.com/jedib0t/go-pretty/v6 v6.4.4
github.com/joho/godotenv v1.4.0
github.com/joho/godotenv v1.5.1
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.1
github.com/urfave/cli/v2 v2.24.2
github.com/urfave/cli/v2 v2.24.4
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
golang.org/x/sys v0.5.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
18 changes: 10 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/jedib0t/go-pretty/v6 v6.4.4 h1:N+gz6UngBPF4M288kiMURPHELDMIhF/Em35aYuKrsSc=
github.com/jedib0t/go-pretty/v6 v6.4.4/go.mod h1:MgmISkTWDSFu0xOqiZ0mKNntMQ2mDgOcwOkwBEkMDJI=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d h1:cVtBfNW5XTHiKQe7jDaDBSh/EVM4XLPutLAGboIXuM0=
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0=
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -30,13 +32,13 @@ github.com/stretchr/testify v1.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/urfave/cli/v2 v2.24.2 h1:q1VA+ofZ8SWfEKB9xXHUD4QZaeI9e+ItEqSbfH2JBXk=
github.com/urfave/cli/v2 v2.24.2/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
github.com/urfave/cli/v2 v2.24.4 h1:0gyJJEBYtCV87zI/x2nZCPyDxD51K6xM8SkwjHFCNEU=
github.com/urfave/cli/v2 v2.24.4/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
8 changes: 4 additions & 4 deletions internal/cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"github.com/jedib0t/go-pretty/v6/text"
"github.com/urfave/cli/v2"

"github.com/tarampampam/tinifier/v4/internal/cli/compress"
"github.com/tarampampam/tinifier/v4/internal/cli/quota"
"github.com/tarampampam/tinifier/v4/internal/env"
"github.com/tarampampam/tinifier/v4/internal/version"
"gh.tarampamp.am/tinifier/v4/internal/cli/compress"
"gh.tarampamp.am/tinifier/v4/internal/cli/quota"
"gh.tarampamp.am/tinifier/v4/internal/env"
"gh.tarampamp.am/tinifier/v4/internal/version"
)

// NewApp creates new console application.
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/tarampampam/tinifier/v4/internal/cli"
"gh.tarampamp.am/tinifier/v4/internal/cli"
)

func TestNewApp(t *testing.T) {
Expand Down
Loading

0 comments on commit d0c8c74

Please sign in to comment.