Skip to content

Commit 30042b5

Browse files
authored
Merge pull request #2 from Format-C-eft/dev
upgrade libs
2 parents fba5894 + a293d8f commit 30042b5

File tree

10 files changed

+54
-51
lines changed

10 files changed

+54
-51
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
go.sum -diff
1+
*.sum -diff
2+
*_gen.go -diff

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Install Go
2020
uses: actions/setup-go@v3
2121
with:
22-
go-version: 1.19.x
22+
go-version: 1.21.x
2323

2424
- name: Build
2525
shell: bash

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ on:
1111
- master
1212

1313
jobs:
14-
lint: # golangci:
15-
name: lint
14+
lint:
15+
name: lint-full
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v3
1919

2020
- name: Install Go
2121
uses: actions/setup-go@v3
2222
with:
23-
go-version: 1.19.x
23+
go-version: 1.21.x
2424

2525
- name: golangci-lint
2626
uses: golangci/golangci-lint-action@v3

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
test:
1515
strategy:
1616
matrix:
17-
go-version: [1.17.x]
17+
go-version: [1.21.x]
1818
os: [ubuntu-latest]
1919
runs-on: ubuntu-latest
2020
steps:
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install Go
2424
uses: actions/setup-go@v3
2525
with:
26-
go-version: 1.19.x
26+
go-version: 1.21.x
2727

2828
- name: Test
2929
shell: bash

.gitignore

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1+
/bin
2+
.DS_STORE
13
/.idea
24
/.vscode
3-
/.run
4-
.DS_STORE
5-
.DS_Store
6-
7-
/bin
8-
coverage.out
5+
/.run

Makefile

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
11
export GO111MODULE=on
2-
export GOSUMDB=off
32

4-
LOCAL_BIN = $(CURDIR)/bin
5-
GOBIN = $(GOPATH)/bin
6-
GOARCH = amd64
3+
ENV_PARAMS ?= CGO_ENABLED=0
4+
LOCAL_BIN := $(CURDIR)/bin
5+
LINT_BIN := $(LOCAL_BIN)/golangci-lint
76

8-
.PHONY: bin-deps
9-
bin-deps:
10-
$(info Installing binary dependencies...)
11-
GOBIN=$(LOCAL_BIN) go install github.com/golangci/golangci-lint/cmd/[email protected]
7+
.PHONY: deps
8+
deps:
9+
$(info Download dependencies...)
10+
go mod download
11+
12+
.PHONY: test
13+
test:
14+
$(info Running test...)
15+
go test ./...
1216

1317
.PHONY: .lint
1418
.lint:
15-
$(LOCAL_BIN)/golangci-lint run --config=.golangci.yaml ./...
19+
$(info Running lint...)
20+
$(LINT_BIN) run --new-from-rev=origin/master --config=.golangci.yaml ./...
21+
22+
.PHONY: .lint-full
23+
.lint-full:
24+
$(info Running lint-full...)
25+
$(LINT_BIN) run --config=.golangci.yaml ./...
26+
27+
.PHONY: lint
28+
lint: install-lint .lint
1629

17-
.PHONY: lint
18-
lint: bin-deps .lint
30+
.PHONY: lint-full
31+
lint-full: install-lint .lint-full
32+
33+
LINT_TAG ?= 1.55.2
34+
install-lint: export GOBIN := $(LOCAL_BIN)
35+
install-lint:
36+
$(info Installing golangci-lint v$(LINT_TAG))
37+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(LINT_TAG)
38+
go mod tidy
1939

2040
.PHONY: build
2141
build: build-linux build-darwin
@@ -29,11 +49,3 @@ build-linux:
2949
build-darwin:
3050
go mod download && CGO_ENABLED=0 \
3151
GOOS=darwin GOARCH=${GOARCH} go build -o ${LOCAL_BIN}/git-update-darwin-${GOARCH} ./cmd/main.go;
32-
33-
.PHONY: test
34-
test:
35-
go test ./... -count=1 -timeout=60s -v -short
36-
37-
.PHONY: install
38-
install:
39-
go build -o $(GOBIN)/protogen -ldflags "$(LDFLAGS)" $(CURDIR)/cmd

go.mod

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
module github.com/Format-C-eft/git-update
22

3-
go 1.19
3+
go 1.21
44

5-
require (
6-
github.com/pkg/errors v0.9.1
7-
github.com/spf13/cobra v1.6.1
8-
)
5+
require github.com/spf13/cobra v1.8.0
96

107
require (
11-
github.com/inconshreveable/mousetrap v1.0.1 // indirect
8+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
129
github.com/spf13/pflag v1.0.5 // indirect
1310
)

go.sum

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
2-
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
3-
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
4-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
5-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
1+
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
2+
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
3+
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
64
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
7-
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
8-
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
5+
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
6+
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
97
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
108
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
119
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

internal/cmd/run.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package cmd
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"os"
78
"strings"
89
"sync"
910

10-
"github.com/pkg/errors"
1111
"github.com/spf13/cobra"
1212

1313
"github.com/Format-C-eft/git-update/internal/shell_executor"
@@ -34,7 +34,7 @@ func cmdRun(_ *cobra.Command, _ []string) error {
3434

3535
listDir, err := getListOfDirectories()
3636
if err != nil {
37-
return errors.Wrap(err, "getListOfDirectories")
37+
return fmt.Errorf("getListOfDirectories err: %w", err)
3838
}
3939

4040
if len(listDir) == 0 {
@@ -55,7 +55,7 @@ func cmdRun(_ *cobra.Command, _ []string) error {
5555
func getListOfDirectories() ([]string, error) {
5656
list, err := os.ReadDir(flagDir)
5757
if err != nil {
58-
return nil, errors.Wrap(err, "os.ReadDir")
58+
return nil, fmt.Errorf("os.ReadDir err: %w", err)
5959
}
6060

6161
listDir := make([]string, 0, len(list))

internal/shell_executor/shell_executor.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"context"
66
"fmt"
77
"os/exec"
8-
9-
"github.com/pkg/errors"
108
)
119

1210
func Run(ctx context.Context, dir string, cmdline ...string) ([]byte, error) {
@@ -20,7 +18,7 @@ func Run(ctx context.Context, dir string, cmdline ...string) ([]byte, error) {
2018
err := cmd.Run()
2119

2220
if err != nil {
23-
return nil, errors.Wrap(err, fmt.Sprintf("%s in %s error: %s", cmdline, dir, stderr.String()))
21+
return nil, fmt.Errorf("%s in %s cmd_error: %s err: %w", cmdline, dir, stderr.String(), err)
2422
}
2523

2624
return stdout.Bytes(), nil

0 commit comments

Comments
 (0)