Skip to content

Commit

Permalink
Upgrade go and alipne
Browse files Browse the repository at this point in the history
  • Loading branch information
yarlson committed Oct 3, 2023
1 parent 604673f commit 1562947
Show file tree
Hide file tree
Showing 10 changed files with 555 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
check:
strategy:
matrix:
go-version: [1.x, 1.13.x, 1.16.x]
go-version: [1.21.x]
runs-on: ubuntu-latest

steps:
Expand Down
44 changes: 32 additions & 12 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ brews:
owner: lokalise
name: homebrew-cli-2
folder: Formula
homepage: "https://docs.lokalise.com/cli2"
homepage: "https://github.com/lokalise/lokalise-cli-2-go"
description: "Lokalise CLI v2"
skip_upload: false
name: lokalise2
Expand All @@ -53,16 +53,36 @@ changelog:
sort: asc

dockers:
-
goos: linux
- image_templates:
- "docker.io/lokalise/lokalise-cli-2:{{ .Tag }}-amd64"
- "ghcr.io/lokalise/lokalise-cli-2:{{ .Tag }}-amd64"
use: buildx
goarch: amd64
goarm: ''
ids:
- lokalise2
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/amd64"
- image_templates:
- "docker.io/lokalise/lokalise-cli-2:{{ .Tag }}-arm64v8"
- "ghcr.io/lokalise/lokalise-cli-2:{{ .Tag }}-arm64v8"
use: buildx
goarch: arm64
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/arm64/v8"
docker_manifests:
- name_template: "docker.io/lokalise/lokalise-cli-2:{{ .Tag }}"
image_templates:
- "docker.io/lokalise/lokalise-cli-2:{{ .Tag }}-arm64v8"
- "docker.io/lokalise/lokalise-cli-2:{{ .Tag }}-amd64"
- name_template: "docker.io/lokalise/lokalise-cli-2:latest"
image_templates:
- "docker.io/lokalise/lokalise-cli-2:{{ .Tag }}-arm64v8"
- "docker.io/lokalise/lokalise-cli-2:{{ .Tag }}-amd64"
- name_template: "ghcr.io/lokalise/lokalise-cli-2:{{ .Tag }}"
image_templates:
- "ghcr.io/lokalise/lokalise-cli-2:{{ .Tag }}-arm64v8"
- "ghcr.io/lokalise/lokalise-cli-2:{{ .Tag }}-amd64"
- name_template: "ghcr.io/lokalise/lokalise-cli-2:latest"
image_templates:
- "docker.io/lokalise/lokalise-cli-2:latest"
- "docker.io/lokalise/lokalise-cli-2:{{ .Tag }}"
- "ghcr.io/lokalise/lokalise-cli-2:latest"
- "ghcr.io/lokalise/lokalise-cli-2:{{ .Tag }}"
skip_push: false
dockerfile: Dockerfile.goreleaser
- "ghcr.io/lokalise/lokalise-cli-2:{{ .Tag }}-arm64v8"
- "ghcr.io/lokalise/lokalise-cli-2:{{ .Tag }}-amd64"
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:latest as certs
FROM alpine:3.18.4 as certs
RUN apk --update add ca-certificates

FROM golang:1.16-alpine3.14 as builder
FROM golang:1.21-alpine3.18 as builder

RUN mkdir -p /build
WORKDIR /build
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.16-alpine3.14 as builder
FROM golang:1.21-alpine3.18 as builder

RUN mkdir -p /build
WORKDIR /build
Expand All @@ -10,7 +10,7 @@ COPY . .

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /bin/lokalise2

FROM alpine:3.14
FROM alpine:3.18.4

RUN apk --update add ca-certificates
COPY --from=builder /bin/lokalise2 /bin/lokalise2
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:latest as certs
FROM alpine:3.18.4 as certs
RUN apk --update add ca-certificates

FROM scratch
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,14 @@ Optionally, you may rename included `config-example.yml` to `config.yml` and set
Only one concurrent request per token is allowed.

## Changes
**2.6.8 (Oct 21, 2021)**
**2.6.9 (Oct 21, 2021)**

- Updated Lokalise GO SDK to v3.4.0
- Upgraded Go to v1.21
- Upgraded Docker images to Alpine 3.18
- Multi arch Docker images

**2.6.8 (Oct 21, 2021)**

- Updated Lokalise GO SDK to v3.2.0

Expand Down
5 changes: 2 additions & 3 deletions cmd/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path"
Expand Down Expand Up @@ -119,7 +118,7 @@ var fileUploadCmd = &cobra.Command{
for _, file := range files {
fmt.Println("Uploading", file+"...")

buf, err := ioutil.ReadFile(file)
buf, err := os.ReadFile(file)
if err != nil {
return err
}
Expand Down Expand Up @@ -366,7 +365,7 @@ func downloadAndUnzip(srcUrl, destPath, unzipPath string) error {
return nil
}

//noinspection GoUnhandledErrorResult
// noinspection GoUnhandledErrorResult
func unzip(src, dest string) error {
r, err := zip.OpenReader(src)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions cmd/screenshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"encoding/base64"
"fmt"
"io/ioutil"
"net/http"
"os"

Expand Down Expand Up @@ -176,7 +175,7 @@ func screenshotToBase64(path string) (string, error) {
return "", fmt.Errorf("unsupported image type: expected image/png or image/jpeg, got %s", cType)
}

buf, _ := ioutil.ReadFile(path)
buf, _ := os.ReadFile(path)
imgBase64Str := base64.StdEncoding.EncodeToString(buf)
return fmt.Sprintf("data:%s;base64,%s", cType, imgBase64Str), nil
}
Expand Down
32 changes: 26 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
module github.com/lokalise/lokalise-cli-2-go

go 1.16
go 1.21

require (
github.com/go-resty/resty/v2 v2.2.0 // indirect
github.com/lokalise/go-lokalise-api/v3 v3.2.0
github.com/spf13/cobra v0.0.6
github.com/lokalise/go-lokalise-api/v3 v3.4.0
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.4.0
golang.org/x/net v0.0.0-20200320220750-118fecf932d8 // indirect
github.com/spf13/viper v1.16.0
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-resty/resty/v2 v2.9.1 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 1562947

Please sign in to comment.