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

chore: update to go1.23, github workflows & README.md #172

Merged
merged 1 commit into from
Sep 9, 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
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#### What Type of Change is this?

- [ ] New Feature
- [ ] Minor Fix
- [ ] Major Improvement
- [ ] Fix
- [ ] Improvement
- [ ] Other

#### Description (required)
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ jobs:

steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ~1.22
go-version-file: "go.mod"
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
env:
CGO_ENABLED: 0

- name: Get dependencies
run: |
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ jobs:

steps:

- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ~1.22
go-version-file: "go.mod"
id: go

- name: Checkout code
uses: actions/checkout@v2
env:
CGO_ENABLED: 0

- name: Get dependencies
run: |
Expand Down Expand Up @@ -101,6 +103,17 @@ jobs:
asset_name: ${{ matrix.file }}
asset_content_type: application/octet-stream

- name: Notify discord about new release
uses: sarisia/actions-status-discord@v1.15.0
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "New version of `zcli` is ready!"
description: |
Version `${{ github.event.release.tag_name }}`
Changelog [here](${{ github.event.release.html_url }})
color: 0xff91a4
username: GitHub

publish-npm:
needs: build
runs-on: ubuntu-latest
Expand Down
3 changes: 0 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ linters:
- gosmopolitan
- govet
- grouper
- ifshort
- importas
- ineffassign
- interfacer
- loggercheck
- maintidx
- makezero
Expand All @@ -67,7 +65,6 @@ linters:
- nilerr
- noctx
- nosprintfhostport
- perfsprint
- prealloc
- predeclared
- promlinter
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
### Optional requirements

- [Wireguard](https://www.wireguard.com/install/) - utilized by `zcli vpn` command.
- ping - utilized by `zcli vpn` command.


<br/>
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/zeropsio/zcli

go 1.21
go 1.23

require github.com/zeropsio/zerops-go v1.0.10

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/serviceLog.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func serviceLogCmd() *cmdBuilder.Cmd {
return handler.Run(ctx, serviceLogs.RunConfig{
Project: *cmdData.Project,
ServiceId: serviceId,
Limit: uint32(cmdData.Params.GetInt("limit")),
Limit: cmdData.Params.GetInt("limit"),
MinSeverity: cmdData.Params.GetString("minimumSeverity"),
MsgType: cmdData.Params.GetString("messageType"),
Format: cmdData.Params.GetString("format"),
Expand Down
2 changes: 1 addition & 1 deletion src/logger/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (hook *VarLogHook) Fire(entry *logrus.Entry) error {

defer f.Close()

_, err = io.WriteString(f, string(msg))
_, err = io.Copy(f, bytes.NewReader(msg))
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to write message, %v", err)
return err
Expand Down
2 changes: 1 addition & 1 deletion src/serviceLogs/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type RunConfig struct {
Project entity.Project
ServiceId uuid.ServiceStackId
Container entity.Container
Limit uint32
Limit int
MinSeverity string
MsgType string
Format string
Expand Down
4 changes: 2 additions & 2 deletions src/serviceLogs/handler_checkInputValues.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (h *Handler) checkInputValues(config RunConfig) (inputValues InputValues, e
}
}
return InputValues{
limit: int(limit),
limit: limit,
minSeverity: severity,
facility: facility,
format: format,
Expand All @@ -53,7 +53,7 @@ func (h *Handler) checkInputValues(config RunConfig) (inputValues InputValues, e
}, nil
}

func (h *Handler) getLimit(config RunConfig) (limit uint32, err error) {
func (h *Handler) getLimit(config RunConfig) (limit int, err error) {
limit = config.Limit

if limit < 1 || limit > 1000 {
Expand Down
2 changes: 1 addition & 1 deletion src/storage/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (h *Handler[T]) load() error {
defer f.Close()

if err := json.NewDecoder(f).Decode(&h.data); err != nil {
return errors.WithMessagef(err, i18n.T(i18n.UnableToDecodeJsonFile, h.config.FilePath))
return errors.WithMessage(err, i18n.T(i18n.UnableToDecodeJsonFile, h.config.FilePath))
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ echo "GOBIN=${GOBIN}"
rm -rf tmp

# https://github.com/golangci/golangci-lint#go Please, do not installDaemon golangci-lint by go get
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$GOBIN" v1.55.2
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$GOBIN" v1.60.3