Skip to content

Commit

Permalink
chore: bump Go and fix lint issues
Browse files Browse the repository at this point in the history
- Bump required Go version from 1.18 to 1.19
- Remove Pointer type (we didn't use anyway, and Go 1.19 have it).
- Fix linter complains

Signed-off-by: Dmitriy Matrenichev <[email protected]>
  • Loading branch information
DmitriyMV committed Aug 3, 2022
1 parent 94427a5 commit 6427893
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 52 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2022-08-02T12:15:47Z by kres latest.
# Generated on 2022-08-03T15:33:56Z by kres latest.

**
!messages
Expand All @@ -15,7 +15,6 @@
!marshal.go
!marshal_test.go
!person_test.go
!pointer.go
!predefined_types.go
!protobuf_test.go
!type_cache.go
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2022-08-02T12:15:47Z by kres latest.
# Generated on 2022-08-03T15:33:56Z by kres latest.

ARG TOOLCHAIN

Expand All @@ -20,7 +20,8 @@ ENV GO111MODULE on
ENV CGO_ENABLED 0
ENV GOPATH /go
ARG GOLANGCILINT_VERSION
RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/${GOLANGCILINT_VERSION}/install.sh | bash -s -- -b /bin ${GOLANGCILINT_VERSION}
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCILINT_VERSION} \
&& mv /go/bin/golangci-lint /bin/golangci-lint
ARG GOFUMPT_VERSION
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
&& mv /go/bin/gofumpt /bin/gofumpt
Expand Down Expand Up @@ -59,7 +60,6 @@ COPY ./map_test.go ./map_test.go
COPY ./marshal.go ./marshal.go
COPY ./marshal_test.go ./marshal_test.go
COPY ./person_test.go ./person_test.go
COPY ./pointer.go ./pointer.go
COPY ./predefined_types.go ./predefined_types.go
COPY ./protobuf_test.go ./protobuf_test.go
COPY ./type_cache.go ./type_cache.go
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2022-08-02T12:15:47Z by kres latest.
# Generated on 2022-08-03T15:29:15Z by kres latest.

# common variables

Expand All @@ -13,11 +13,11 @@ USERNAME ?= siderolabs
REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
GOLANGCILINT_VERSION ?= v1.47.3
GOFUMPT_VERSION ?= v0.3.1
GO_VERSION ?= 1.18
GO_VERSION ?= 1.19
GOIMPORTS_VERSION ?= v0.1.11
PROTOBUF_GO_VERSION ?= 1.28.0
PROTOBUF_GO_VERSION ?= 1.28.1
GRPC_GO_VERSION ?= 1.2.0
GRPC_GATEWAY_VERSION ?= 2.10.0
GRPC_GATEWAY_VERSION ?= 2.11.1
VTPROTOBUF_VERSION ?= 0.3.0
DEEPCOPY_VERSION ?= v0.5.5
TESTPKGS ?= ./...
Expand Down Expand Up @@ -49,7 +49,7 @@ COMMON_ARGS += --build-arg=GRPC_GATEWAY_VERSION=$(GRPC_GATEWAY_VERSION)
COMMON_ARGS += --build-arg=VTPROTOBUF_VERSION=$(VTPROTOBUF_VERSION)
COMMON_ARGS += --build-arg=DEEPCOPY_VERSION=$(DEEPCOPY_VERSION)
COMMON_ARGS += --build-arg=TESTPKGS=$(TESTPKGS)
TOOLCHAIN ?= docker.io/golang:1.18-alpine
TOOLCHAIN ?= docker.io/golang:1.19-alpine

# help menu

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/siderolabs/protoenc

go 1.18
go 1.19

require (
github.com/brianvoe/gofakeit/v6 v6.17.0
Expand Down
2 changes: 2 additions & 0 deletions person_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

// Go-based protobuf definition for the example Person message format
//
//nolint:govet
type Person struct {
Name string `protobuf:"1"`
Expand All @@ -37,6 +38,7 @@ type PhoneNumber struct {

// This example defines, encodes, and decodes a Person message format
// equivalent to the example used in the Protocol Buffers overview.
//
//nolint:nosnakecase
func Example_protobuf() {
// Create a Person record
Expand Down
24 changes: 0 additions & 24 deletions pointer.go

This file was deleted.

34 changes: 17 additions & 17 deletions protobuf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,24 +222,24 @@ func TestTimeTypesEncodeDecode(t *testing.T) {
assert.Equal(t, in.Duration, out.Duration)
}

/* encoding of testMsg is equivalent to the encoding to the following in
a .proto file:
message cipherText {
int32 a = 1;
int32 b = 2;
}
message MapFieldEntry {
uint32 key = 1;
cipherText value = 2;
}
message testMsg {
repeated MapFieldEntry map_field = 1;
}
for details see:
https://developers.google.com/protocol-buffers/docs/proto#backwards-compatibility */
type wrongTestMsg struct {
/* encoding of testMsg is equivalent to the encoding to the following in
a .proto file:
message cipherText {
int32 a = 1;
int32 b = 2;
}
message MapFieldEntry {
uint32 key = 1;
cipherText value = 2;
}
message testMsg {
repeated MapFieldEntry map_field = 1;
}
for details see:
https://developers.google.com/protocol-buffers/docs/proto#backwards-compatibility */
M map[uint32][]cipherText
}

Expand Down
1 change: 1 addition & 0 deletions type_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func StructFields(typ reflect.Type) ([]FieldData, error) {
}

// FieldData represents a field of a struct with proto number and field index.
//
//nolint:govet
type FieldData struct {
Num protowire.Number
Expand Down

0 comments on commit 6427893

Please sign in to comment.