Skip to content

Commit bdf2ea3

Browse files
authored
CR-21610 - refactor go-sdk, release v1.0.0 (#458)
* removed binary command code * split to packages * added a single unit-test, as an example
1 parent 0d8619b commit bdf2ea3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+4643
-3678
lines changed

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Output of the go coverage tool, specifically when used with LiteIDE
15+
*.out
16+
17+
# Dependency directories (remove the comment below to include it)
18+
# vendor/
19+
20+
# Go workspace file
21+
go.work
22+
23+
cover

.mockery.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dir: pkg/mocks
2+
filename: "{{.PackageName}}_mock.go"
3+
mockname: "Mock{{.InterfaceName}}"
4+
outpkg: "mocks"
5+
with-expecter: true
6+
packages:
7+
net/http:
8+
interfaces:
9+
RoundTripper: {}

Makefile

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
VERSION=v1.0.0
2+
3+
ifndef GOBIN
4+
ifndef GOPATH
5+
$(error GOPATH is not set, please make sure you set your GOPATH correctly!)
6+
endif
7+
GOBIN=$(GOPATH)/bin
8+
ifndef GOBIN
9+
$(error GOBIN is not set, please make sure you set your GOBIN correctly!)
10+
endif
11+
endif
12+
13+
.PHONY: test-all
14+
test-all: test test-fmt
15+
16+
.PHONY: test
17+
test:
18+
@sh ./scripts/test.sh
19+
20+
.PHONY: test-fmt
21+
test-fmt:
22+
@sh ./scripts/test-fmt.sh
23+
24+
.PHONY: lint
25+
lint: $(GOBIN)/golangci-lint
26+
@echo linting go code...
27+
@$(GOBIN)/golangci-lint run --fix --timeout 10m
28+
29+
30+
# Fix fmt errors in file
31+
.PHONY: fmt
32+
fmt:
33+
go fmt ./...
34+
35+
# Generate mock struct from interface
36+
# example: make mock PKG=./pkg/runtime NAME=Runtime
37+
.PHONY: mock
38+
mock: $(GOBIN)/mockery
39+
@mockery
40+
41+
# Runs cript to upload codecov coverage data
42+
.PHONY: upload-coverage
43+
upload-coverage:
44+
@./scripts/codecov.sh -t $(CODECOV_TOKEN)
45+
46+
.PHONY: cur-version
47+
cur-version:
48+
@echo -n $(VERSION)
49+
50+
$(GOBIN)/mockery:
51+
@go install github.com/vektra/mockery/[email protected]
52+
@mockery --version
53+
54+
$(GOBIN)/golangci-lint:
55+
@echo installing: golangci-lint
56+
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.55.2

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"os"
1515

1616
"github.com/codefresh-io/go-sdk/pkg/utils"
17-
"github.com/codefresh-io/go-sdk/pkg/codefresh"
17+
"github.com/codefresh-io/go-sdk/pkg"
1818
)
1919

2020
func main() {

VERSION

-1
This file was deleted.

cmd/create.go

-27
This file was deleted.

cmd/create_runtime_environment.go

-69
This file was deleted.

cmd/create_token.go

-42
This file was deleted.

cmd/delete.go

-28
This file was deleted.

cmd/delete_runtime_environment.go

-51
This file was deleted.

cmd/get.go

-27
This file was deleted.

0 commit comments

Comments
 (0)