Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch go to 1.21. #10

Merged
merged 5 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
build_platforms: "linux/amd64,linux/arm64"
app_name: "gpbackman"
steps:
- name: Set up go 1.20
- name: Set up go 1.21
uses: actions/setup-go@v3
with:
go-version: "1.20"
go-version: "1.21"
id: go
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -31,7 +31,7 @@ jobs:
- name: Run linters
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.3
version: v1.56.2
env:
TZ: "Etc/UTC"

Expand Down Expand Up @@ -110,12 +110,12 @@ jobs:
needs: build
runs-on: ubuntu-latest
env:
goreleaser_version: "v1.20.0"
goreleaser_version: "v1.24.0"
steps:
- name: Set up go 1.20
- name: Set up go 1.21
uses: actions/setup-go@v3
with:
go-version: "1.20"
go-version: "1.21"
id: go

- name: Checkout
Expand Down
20 changes: 16 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ linters-settings:
check-shadowing: true
revive:
confidence: 0.1
golint:
min-confidence: 0.1
maligned:
suggest-new: true
goconst:
Expand All @@ -21,6 +23,18 @@ linters-settings:
line-length: 140
gocyclo:
min-complexity: 25
gocritic:
enabled-tags:
- performance
- style
- experimental
disabled-checks:
- filepathJoin
- hugeParam
- rangeValCopy
- octalLiteral
- unnamedResult
- todoCommentWithoutDetail

linters:
enable:
Expand Down Expand Up @@ -49,13 +63,11 @@ linters:

issues:
exclude-rules:
- path: _test\.go
linters:
- gosec
- text: "at least one file in a package should have a package comment"
linters:
- stylecheck
- text: "G104: Errors unhandled"
- path: _test\.go
linters:
- gosec
- dupl
exclude-use-default: false
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
ARG REPO_BUILD_TAG="unknown"

# Pin alpine 3.18.
# See https://github.com/mattn/go-sqlite3/issues/1164#issuecomment-1848677118
FROM golang:1.20-alpine3.18 AS builder
FROM golang:1.21-alpine3.19 AS builder
ARG REPO_BUILD_TAG
COPY . /build
WORKDIR /build
Expand All @@ -12,7 +10,7 @@ RUN apk add --no-cache --update build-base \
-ldflags "-X main.version=${REPO_BUILD_TAG}" \
-o gpbackman gpbackman.go

FROM alpine:3.18
FROM alpine:3.19
ARG REPO_BUILD_TAG
ENV TZ="Etc/UTC" \
GPBACKMAN_USER="gpbackman" \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.artifacts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM --platform=linux/amd64 goreleaser/goreleaser:v1.20.0 as builder
FROM --platform=linux/amd64 goreleaser/goreleaser:v1.24.0 as builder
WORKDIR /build
COPY . /build
RUN goreleaser release --snapshot --skip-publish --clean

FROM alpine
FROM alpine:3.19
COPY --from=builder /build/dist/ /dist/
RUN mkdir -p /artifacts && \
cp /dist/*.tar.gz /artifacts/ && \
Expand Down
4 changes: 2 additions & 2 deletions cmd/backup_clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func cleanBackup() error {
gplog.Error(textmsg.ErrorTextUnableActionHistoryDB("close", closeErr))
}
}()
if len(backupCleanPluginConfigFile) > 0 {
if backupCleanPluginConfigFile != "" {
pluginConfig, err := utils.ReadPluginConfig(backupCleanPluginConfigFile)
if err != nil {
gplog.Error(textmsg.ErrorTextUnableReadPluginConfigFile(err))
Expand All @@ -157,7 +157,7 @@ func cleanBackup() error {
return err
}
if len(parseHData.BackupConfigs) != 0 {
if len(backupCleanPluginConfigFile) > 0 {
if backupCleanPluginConfigFile != "" {
pluginConfig, err := utils.ReadPluginConfig(backupCleanPluginConfigFile)
if err != nil {
gplog.Error(textmsg.ErrorTextUnableReadPluginConfigFile(err))
Expand Down
10 changes: 5 additions & 5 deletions cmd/backup_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func init() {
false,
"try to delete, even if the backup already mark as deleted",
)
backupDeleteCmd.MarkPersistentFlagRequired(timestampFlagName)
_ = backupDeleteCmd.MarkPersistentFlagRequired(timestampFlagName)
}

// These flag checks are applied only for backup-delete command.
Expand Down Expand Up @@ -130,7 +130,7 @@ func deleteBackup() error {
gplog.Error(textmsg.ErrorTextUnableActionHistoryDB("close", closeErr))
}
}()
if len(backupDeletePluginConfigFile) > 0 {
if backupDeletePluginConfigFile != "" {
pluginConfig, err := utils.ReadPluginConfig(backupDeletePluginConfigFile)
if err != nil {
return err
Expand All @@ -153,7 +153,7 @@ func deleteBackup() error {
return err
}
if len(parseHData.BackupConfigs) != 0 {
if len(backupDeletePluginConfigFile) > 0 {
if backupDeletePluginConfigFile != "" {
pluginConfig, err := utils.ReadPluginConfig(backupDeletePluginConfigFile)
if err != nil {
return err
Expand Down Expand Up @@ -252,7 +252,7 @@ func backupDeleteDBPluginFunc(backupName, pluginConfigPath string, pluginConfig
}
gplog.Debug(textmsg.InfoTextPluginCommandExecution(pluginConfig.ExecutablePath, deleteBackupPluginCommand, pluginConfigPath, backupName))
stdout, stderr, errdel := execDeleteBackup(pluginConfig.ExecutablePath, deleteBackupPluginCommand, pluginConfigPath, backupName)
if len(stderr) > 0 {
if stderr != "" {
gplog.Error(stderr)
}
if errdel != nil {
Expand Down Expand Up @@ -343,7 +343,7 @@ func backupDeleteFilePluginFunc(backupData gpbckpconfig.BackupConfig, parseHData
}
gplog.Debug(textmsg.InfoTextPluginCommandExecution(pluginConfig.ExecutablePath, deleteBackupPluginCommand, pluginConfigPath, backupName))
stdout, stderr, errdel := execDeleteBackup(pluginConfig.ExecutablePath, deleteBackupPluginCommand, pluginConfigPath, backupName)
if len(stderr) > 0 {
if stderr != "" {
gplog.Error(stderr)
}
if errdel != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const (
var (
// Variable for determining history db format: file or sqlite db.
// By default, true - sqlite db.
historyDB bool = true
historyDB = true
// Timestamp to delete all backups before.
beforeTimestamp string = ""
beforeTimestamp string
)
8 changes: 4 additions & 4 deletions cmd/report_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func init() {
"",
"the full path to plugin report file",
)
reportInfoCmd.MarkPersistentFlagRequired(timestampFlagName)
_ = reportInfoCmd.MarkPersistentFlagRequired(timestampFlagName)
}

// These flag checks are applied only for report-info command.
Expand Down Expand Up @@ -128,7 +128,7 @@ func reportInfo() error {
gplog.Error(textmsg.ErrorTextUnableActionHistoryDB("close", closeErr))
}
}()
if len(reportInfoPluginConfigFile) > 0 {
if reportInfoPluginConfigFile != "" {
pluginConfig, err := utils.ReadPluginConfig(reportInfoPluginConfigFile)
if err != nil {
gplog.Error(textmsg.ErrorTextUnableReadPluginConfigFile(err))
Expand Down Expand Up @@ -158,7 +158,7 @@ func reportInfo() error {
return err
}
if len(parseHData.BackupConfigs) != 0 {
if len(reportInfoPluginConfigFile) > 0 {
if reportInfoPluginConfigFile != "" {
pluginConfig, err := utils.ReadPluginConfig(reportInfoPluginConfigFile)
if err != nil {
return err
Expand Down Expand Up @@ -225,7 +225,7 @@ func reportInfoPluginFunc(backupData gpbckpconfig.BackupConfig, pluginConfigPath
}
gplog.Debug(textmsg.InfoTextPluginCommandExecution(pluginConfig.ExecutablePath, restoreDataPluginCommand, pluginConfigPath, reportFile))
stdout, stderr, err := execReportInfo(pluginConfig.ExecutablePath, restoreDataPluginCommand, pluginConfigPath, reportFile)
if len(stderr) > 0 {
if stderr != "" {
gplog.Error(stderr)
}
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion e2e_tests/conf/Dockerfile.s3_plugin
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG S3_PLUGIN_VERSION="1.10.1"

FROM golang:1.20-alpine AS s3_plugin-builder
FROM golang:1.21-alpine3.19 AS s3_plugin-builder
ARG S3_PLUGIN_VERSION
RUN apk add --no-cache --update build-base bash perl \
&& wget https://github.com/greenplum-db/gpbackup-s3-plugin/archive/refs/tags/${S3_PLUGIN_VERSION}.tar.gz -O /tmp/gpbackup-s3-plugin-${S3_PLUGIN_VERSION}.tar.gz \
Expand Down
35 changes: 18 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module github.com/woblerr/gpbackman

go 1.20
go 1.21

require (
github.com/greenplum-db/gp-common-go-libs v1.0.12
github.com/greenplum-db/gpbackup v0.0.0-20230711125400-c1132cc78e89
github.com/greenplum-db/gp-common-go-libs v1.0.15
github.com/greenplum-db/gpbackup v0.0.0-20240215213028-2782cd0fbd9b
github.com/jedib0t/go-pretty v4.3.0+incompatible
github.com/nightlyone/lockfile v1.0.0
github.com/spf13/cobra v1.7.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
gopkg.in/yaml.v2 v2.4.0
)
Expand All @@ -17,30 +17,31 @@ require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blang/vfs v1.0.0 // indirect
github.com/go-openapi/errors v0.20.3 // indirect
github.com/go-openapi/strfmt v0.21.7 // indirect
github.com/go-openapi/errors v0.21.0 // indirect
github.com/go-openapi/strfmt v0.22.0 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.0 // indirect
github.com/jackc/pgconn v1.14.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgtype v1.14.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/pgtype v1.14.2 // indirect
github.com/jackc/pgx/v4 v4.18.1 // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-sqlite3 v1.14.19 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/onsi/gomega v1.27.2 // indirect
github.com/onsi/gomega v1.27.10 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
go.mongodb.org/mongo-driver v1.11.3 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.15.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect
golang.org/x/crypto v0.20.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading
Loading