Skip to content

Commit 6effa9a

Browse files
committed
Fix golangci-lint warnings and update tests
* Update minimum expected Go version to v1.17 * Remove deprecated golint tooling
1 parent 3f475c8 commit 6effa9a

File tree

10 files changed

+106
-34
lines changed

10 files changed

+106
-34
lines changed

.github/workflows/test.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,5 @@ jobs:
2323
- name: checkout
2424
uses: actions/checkout@v3
2525

26-
- name: tools
27-
run: go install golang.org/x/lint/golint@latest
28-
2926
- name: test
3027
run: make

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ VERSION=$(shell git describe --tags --match=v* --always --dirty)
44
SEMVER=$(shell git describe --tags --match=v* --always --dirty | cut -c 2-)
55

66
.PHONY: all
7-
all: build test vet lint fmt
7+
all: build test vet fmt
88

99
.PHONY: build
1010
build: clean bin/terraform-provider-matchbox
@@ -20,10 +20,6 @@ test:
2020
vet:
2121
@go vet -all ./...
2222

23-
.PHONY: lint
24-
lint:
25-
@golint -set_exit_status `go list ./...`
26-
2723
.PHONY: fmt
2824
fmt:
2925
@test -z $$(go fmt ./...)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ See [examples](https://github.com/poseidon/matchbox/tree/master/examples/terrafo
7979

8080
### Binary
8181

82-
To develop the provider plugin locally, build an executable with Go 1.16+.
82+
To develop the provider plugin locally, build an executable with Go 1.17+.
8383

8484
```
8585
make

go.mod

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,53 @@ require (
66
google.golang.org/grpc v1.48.0
77
)
88

9-
go 1.16
9+
require (
10+
github.com/agext/levenshtein v1.2.2 // indirect
11+
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
12+
github.com/davecgh/go-spew v1.1.1 // indirect
13+
github.com/fatih/color v1.13.0 // indirect
14+
github.com/golang/protobuf v1.5.2 // indirect
15+
github.com/google/go-cmp v0.5.8 // indirect
16+
github.com/hashicorp/errwrap v1.0.0 // indirect
17+
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
18+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
19+
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
20+
github.com/hashicorp/go-hclog v1.2.1 // indirect
21+
github.com/hashicorp/go-multierror v1.1.1 // indirect
22+
github.com/hashicorp/go-plugin v1.4.4 // indirect
23+
github.com/hashicorp/go-uuid v1.0.3 // indirect
24+
github.com/hashicorp/go-version v1.6.0 // indirect
25+
github.com/hashicorp/hc-install v0.4.0 // indirect
26+
github.com/hashicorp/hcl/v2 v2.13.0 // indirect
27+
github.com/hashicorp/logutils v1.0.0 // indirect
28+
github.com/hashicorp/terraform-exec v0.17.2 // indirect
29+
github.com/hashicorp/terraform-json v0.14.0 // indirect
30+
github.com/hashicorp/terraform-plugin-go v0.12.0 // indirect
31+
github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect
32+
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect
33+
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
34+
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
35+
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
36+
github.com/mattn/go-colorable v0.1.12 // indirect
37+
github.com/mattn/go-isatty v0.0.14 // indirect
38+
github.com/mitchellh/copystructure v1.2.0 // indirect
39+
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
40+
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
41+
github.com/mitchellh/mapstructure v1.5.0 // indirect
42+
github.com/mitchellh/reflectwalk v1.0.2 // indirect
43+
github.com/oklog/run v1.0.0 // indirect
44+
github.com/sirupsen/logrus v1.4.2 // indirect
45+
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
46+
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
47+
github.com/vmihailenco/tagparser v0.1.1 // indirect
48+
github.com/zclconf/go-cty v1.10.0 // indirect
49+
golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 // indirect
50+
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
51+
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
52+
golang.org/x/text v0.3.7 // indirect
53+
google.golang.org/appengine v1.6.6 // indirect
54+
google.golang.org/genproto v0.0.0-20200711021454-869866162049 // indirect
55+
google.golang.org/protobuf v1.28.0 // indirect
56+
)
57+
58+
go 1.17

matchbox/fixture_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ func NewFixtureServer(clientTLS *TLSContents, serverTLS *tlsutil.TLSInfo, s stor
6060
}
6161
}
6262

63-
func (s *FixtureServer) Start() {
63+
func (s *FixtureServer) Start() error {
6464
cfg, err := s.ServerTLS.ServerConfig()
6565
if err != nil {
66-
panic(fmt.Errorf("Invalid TLS credentials: %v", err))
66+
return fmt.Errorf("Invalid TLS credentials: %v", err)
6767
}
6868

6969
srv := server.NewServer(&server.Config{Store: s.Store})
7070
s.Server = rpc.NewServer(srv, cfg)
71-
s.Server.Serve(s.Listener)
71+
return s.Server.Serve(s.Listener)
7272
}
7373

7474
func (s *FixtureServer) Stop() {

matchbox/provider.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ import (
1010
func Provider() *schema.Provider {
1111
return &schema.Provider{
1212
Schema: map[string]*schema.Schema{
13-
"endpoint": &schema.Schema{
13+
"endpoint": {
1414
Type: schema.TypeString,
1515
Required: true,
1616
},
17-
"client_cert": &schema.Schema{
17+
"client_cert": {
1818
Type: schema.TypeString,
1919
Required: true,
2020
},
21-
"client_key": &schema.Schema{
21+
"client_key": {
2222
Type: schema.TypeString,
2323
Required: true,
2424
},
25-
"ca": &schema.Schema{
25+
"ca": {
2626
Type: schema.TypeString,
2727
Required: true,
2828
},

matchbox/resource_group.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ func resourceGroup() *schema.Resource {
1919
DeleteContext: resourceGroupDelete,
2020

2121
Schema: map[string]*schema.Schema{
22-
"name": &schema.Schema{
22+
"name": {
2323
Type: schema.TypeString,
2424
Required: true,
2525
ForceNew: true,
2626
},
27-
"profile": &schema.Schema{
27+
"profile": {
2828
Type: schema.TypeString,
2929
Required: true,
3030
ForceNew: true,
3131
},
32-
"selector": &schema.Schema{
32+
"selector": {
3333
Type: schema.TypeMap,
3434
Optional: true,
3535
Elem: schema.TypeString,
3636
ForceNew: true,
3737
},
38-
"metadata": &schema.Schema{
38+
"metadata": {
3939
Type: schema.TypeMap,
4040
Optional: true,
4141
Elem: schema.TypeString,

matchbox/resource_group_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ import (
1111

1212
func TestResourceGroup(t *testing.T) {
1313
srv := NewFixtureServer(clientTLSInfo, serverTLSInfo, testfakes.NewFixedStore())
14-
go srv.Start()
14+
go func() {
15+
err := srv.Start()
16+
if err != nil {
17+
t.Errorf("fixture server start: %v", err)
18+
}
19+
}()
1520
defer srv.Stop()
1621

1722
hcl := `
@@ -67,7 +72,12 @@ func TestResourceGroup(t *testing.T) {
6772
// the Terraform state.
6873
func TestResourceGroup_Read(t *testing.T) {
6974
srv := NewFixtureServer(clientTLSInfo, serverTLSInfo, testfakes.NewFixedStore())
70-
go srv.Start()
75+
go func() {
76+
err := srv.Start()
77+
if err != nil {
78+
t.Errorf("fixture server start: %v", err)
79+
}
80+
}()
7181
defer srv.Stop()
7282

7383
hcl := `

matchbox/resource_profile.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,43 +21,43 @@ func resourceProfile() *schema.Resource {
2121
DeleteContext: resourceProfileDelete,
2222

2323
Schema: map[string]*schema.Schema{
24-
"name": &schema.Schema{
24+
"name": {
2525
Type: schema.TypeString,
2626
Required: true,
2727
ForceNew: true,
2828
},
29-
"kernel": &schema.Schema{
29+
"kernel": {
3030
Type: schema.TypeString,
3131
Optional: true,
3232
ForceNew: true,
3333
},
34-
"initrd": &schema.Schema{
34+
"initrd": {
3535
Type: schema.TypeList,
3636
Elem: &schema.Schema{
3737
Type: schema.TypeString,
3838
},
3939
Optional: true,
4040
ForceNew: true,
4141
},
42-
"args": &schema.Schema{
42+
"args": {
4343
Type: schema.TypeList,
4444
Elem: &schema.Schema{
4545
Type: schema.TypeString,
4646
},
4747
Optional: true,
4848
ForceNew: true,
4949
},
50-
"container_linux_config": &schema.Schema{
50+
"container_linux_config": {
5151
Type: schema.TypeString,
5252
Optional: true,
5353
ForceNew: true,
5454
},
55-
"raw_ignition": &schema.Schema{
55+
"raw_ignition": {
5656
Type: schema.TypeString,
5757
Optional: true,
5858
ForceNew: true,
5959
},
60-
"generic_config": &schema.Schema{
60+
"generic_config": {
6161
Type: schema.TypeString,
6262
Optional: true,
6363
ForceNew: true,

matchbox/resource_profile_test.go

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import (
1212

1313
func TestResourceProfile(t *testing.T) {
1414
srv := NewFixtureServer(clientTLSInfo, serverTLSInfo, testfakes.NewFixedStore())
15-
go srv.Start()
15+
go func() {
16+
err := srv.Start()
17+
if err != nil {
18+
t.Errorf("fixture server start: %v", err)
19+
}
20+
}()
1621
defer srv.Stop()
1722

1823
hcl := `
@@ -93,7 +98,12 @@ func TestResourceProfile(t *testing.T) {
9398

9499
func TestResourceProfile_withIgnition(t *testing.T) {
95100
srv := NewFixtureServer(clientTLSInfo, serverTLSInfo, testfakes.NewFixedStore())
96-
go srv.Start()
101+
go func() {
102+
err := srv.Start()
103+
if err != nil {
104+
t.Errorf("fixture server start: %v", err)
105+
}
106+
}()
97107
defer srv.Stop()
98108

99109
hcl := `
@@ -146,7 +156,12 @@ func TestResourceProfile_withIgnition(t *testing.T) {
146156

147157
func TestResourceProfile_withIgnitionAndContainerLinuxConfig(t *testing.T) {
148158
srv := NewFixtureServer(clientTLSInfo, serverTLSInfo, testfakes.NewFixedStore())
149-
go srv.Start()
159+
go func() {
160+
err := srv.Start()
161+
if err != nil {
162+
t.Errorf("fixture server start: %v", err)
163+
}
164+
}()
150165
defer srv.Stop()
151166

152167
hcl := `
@@ -170,7 +185,12 @@ func TestResourceProfile_withIgnitionAndContainerLinuxConfig(t *testing.T) {
170185
// the Terraform state.
171186
func TestResourceProfile_Read(t *testing.T) {
172187
srv := NewFixtureServer(clientTLSInfo, serverTLSInfo, testfakes.NewFixedStore())
173-
go srv.Start()
188+
go func() {
189+
err := srv.Start()
190+
if err != nil {
191+
t.Errorf("fixture server start: %v", err)
192+
}
193+
}()
174194
defer srv.Stop()
175195

176196
hcl := `

0 commit comments

Comments
 (0)