Skip to content

Commit 4a4c55f

Browse files
update tools and remove deprecated io lib
1 parent 7db0b50 commit 4a4c55f

18 files changed

+52
-71
lines changed

GNUmakefile

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@ PKG_NAME=codefresh
66
NAMESPACE=app
77
BINARY=terraform-provider-${PKG_NAME}
88
OS_ARCH=darwin_amd64
9-
TFPLUGINDOCS_VERSION=v0.14.1
109

1110
default: build
1211

13-
tools:
14-
GO111MODULE=on go install github.com/client9/misspell/cmd/misspell
15-
GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint
16-
GO111MODULE=on go install github.com/bflad/tfproviderlint/cmd/tfproviderlint
17-
1812
build: fmtcheck
1913
go install
2014
go build -o ${BINARY}
@@ -31,7 +25,7 @@ fmtcheck:
3125

3226
lint:
3327
@echo "==> Checking source code against linters..."
34-
golangci-lint run ./...
28+
go tool golangci-lint run ./...
3529

3630
test: fmtcheck
3731
go test -i $(TEST) || exit 1
@@ -58,13 +52,8 @@ vet:
5852
exit 1; \
5953
fi
6054

61-
docs-prepare:
62-
@echo "==> Setting up tfplugindocs..."
63-
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@${TFPLUGINDOCS_VERSION}
64-
65-
docs: docs-prepare
55+
docs:
6656
@echo "==> Generating Provider Documentation..."
67-
tfplugindocs generate
68-
69-
.PHONY: build test testacc vet fmt fmtcheck lint tools test-compile docs docs-prepare
57+
go tool tfplugindocs generate
7058

59+
.PHONY: build test testacc vet fmt fmtcheck lint test-compile docs docs-prepare

codefresh.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ steps:
3939
# The following will resolve to their latest patch version
4040
environment:
4141
- TF_VERSION=1.3.0
42-
- TF_VERSION=1.7.0
42+
- TF_VERSION=1.11.4
4343
when:
4444
condition:
4545
all:

codefresh/cfclient/account.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"errors"
55
"fmt"
66

7-
"github.com/imdario/mergo"
7+
"dario.cat/mergo"
88
)
99

1010
type DockerRegistry struct {

codefresh/cfclient/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"net/http"
99
"strings"
1010
)
@@ -71,7 +71,7 @@ func (client *Client) RequestAPI(opt *RequestOptions) ([]byte, error) {
7171
}
7272
defer resp.Body.Close()
7373

74-
body, err := ioutil.ReadAll(resp.Body)
74+
body, err := io.ReadAll(resp.Body)
7575
if err != nil {
7676
return nil, fmt.Errorf("Failed to read body %v %v", resp.StatusCode, resp.Status)
7777
}
@@ -103,7 +103,7 @@ func (client *Client) RequestApiXAccessToken(opt *RequestOptions) ([]byte, error
103103
}
104104
defer resp.Body.Close()
105105

106-
body, err := ioutil.ReadAll(resp.Body)
106+
body, err := io.ReadAll(resp.Body)
107107
if err != nil {
108108
return nil, fmt.Errorf("Failed to read body %v %v", resp.StatusCode, resp.Status)
109109
}

codefresh/cfclient/gql_client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"encoding/json"
66
"errors"
7-
"io/ioutil"
7+
"io"
88
"net/http"
99
)
1010

@@ -38,7 +38,7 @@ func (client *Client) SendGqlRequest(request GraphQLRequest) ([]byte, error) {
3838
return nil, err
3939
}
4040
if resp.StatusCode >= 400 {
41-
bodyBytes, _ := ioutil.ReadAll(resp.Body)
41+
bodyBytes, _ := io.ReadAll(resp.Body)
4242
return nil, errors.New(resp.Status + " " + string(bodyBytes))
4343
}
4444
defer resp.Body.Close()

codefresh/internal/datautil/yaml.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package datautil
22

33
import (
4-
"io/ioutil"
4+
"io"
55
"strings"
6-
76
"github.com/mikefarah/yq/v4/pkg/yqlib"
87
"gopkg.in/op/go-logging.v1"
98
)
@@ -24,7 +23,7 @@ func Yq(yamlString string, expression string, outputformat string) (string, erro
2423
yqEvaluator := yqlib.NewStringEvaluator()
2524

2625
// Disable yq logging
27-
yqLogBackend := logging.AddModuleLevel(logging.NewLogBackend(ioutil.Discard, "", 0))
26+
yqLogBackend := logging.AddModuleLevel(logging.NewLogBackend(io.Discard, "", 0))
2827
yqlib.GetLogger().SetBackend(yqLogBackend)
2928

3029
yamlString, err := yqEvaluator.Evaluate(yamlString, expression, yqEncoder, yqDecoder)

codefresh/resource_step_types_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package codefresh
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"log"
76
"os"
87
"regexp"
@@ -49,7 +48,7 @@ func TestCleanUpStepFromTransientValues(t *testing.T) {
4948

5049
func TestNormalizeYamlStringStepTypes(t *testing.T) {
5150
testFile := "../test_data/step_types/testStepWithRuntimeData.yaml"
52-
yamlString, err := ioutil.ReadFile(testFile)
51+
yamlString, err := os.ReadFile(testFile)
5352
if err != nil {
5453
t.Errorf("Unable to open test file %s. Err: #%v ", testFile, err)
5554
}
@@ -85,7 +84,7 @@ func TestSortVersions(t *testing.T) {
8584

8685
func TestExtractSteps(t *testing.T) {
8786
testFile := "../test_data/step_types/testStepTypesOrder.yaml"
88-
yamlString, err := ioutil.ReadFile(testFile)
87+
yamlString, err := os.ReadFile(testFile)
8988
if err != nil {
9089
t.Errorf("Unable to read file %s", testFile)
9190
}
@@ -112,11 +111,11 @@ func TestAccCodefreshStepTypes(t *testing.T) {
112111
}
113112
name := accountName + "/" + stepTypesNamePrefix + acctest.RandString(10)
114113
resourceName := "codefresh_step_types.test"
115-
contentStepsV1, err := ioutil.ReadFile("../test_data/step_types/testSteps.yaml")
114+
contentStepsV1, err := os.ReadFile("../test_data/step_types/testSteps.yaml")
116115
if err != nil {
117116
log.Fatal(err)
118117
}
119-
contentStepsV2, err := ioutil.ReadFile("../test_data/step_types/testStepsTemplate.yaml")
118+
contentStepsV2, err := os.ReadFile("../test_data/step_types/testStepsTemplate.yaml")
120119
if err != nil {
121120
log.Fatal(err)
122121
}

docs/data-sources/account_gitops_settings.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ This data source retrieves gitops settings for the active account
2323
- `id` (String) Account Id
2424
- `name` (String) Account name for active account
2525
- `shared_config_repository` (String) Shared config repository url
26-
27-

docs/data-sources/account_idp.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,3 @@ This data source retrieves an account level identity provider
2828
- `login_url` (String) Login url using the IDP to Codefresh
2929
- `redirect_ui_url` (String) UI Callback url for the identity provider
3030
- `redirect_url` (String) API Callback url for the identity provider
31-
32-

docs/data-sources/current_account.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,5 @@ current_ac = {
6969
Required:
7070

7171
- `email` (String)
72-
- `name` (String)
73-
74-
Read-Only:
75-
76-
- `id` (String) The ID of this resource.
72+
- `id` (String)
73+
- `name` (String)

0 commit comments

Comments
 (0)