diff --git a/.golangci.yml b/.golangci.yml index 3b21170..b7262cf 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2022-06-22T12:59:39Z by kres 65530e7. +# Generated on 2022-09-06T19:01:35Z by kres 871f67c. # options for analysis running run: @@ -36,7 +36,7 @@ linters-settings: lines: 60 statements: 40 gci: - local-prefixes: github.com/talos-systems/crypto + local-prefixes: github.com/siderolabs/crypto gocognit: min-complexity: 30 ireturn: @@ -65,7 +65,7 @@ linters-settings: gofmt: simplify: true goimports: - local-prefixes: github.com/talos-systems/crypto + local-prefixes: github.com/siderolabs/crypto golint: min-confidence: 0.8 gomnd: @@ -135,7 +135,10 @@ linters: - goerr113 - gomnd - gomoddirectives + - ireturn - nestif + - nonamedreturns + - nosnakecase - paralleltest - tagliatelle - thelper diff --git a/Dockerfile b/Dockerfile index 0ebd074..7055084 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2022-06-22T12:59:39Z by kres 65530e7. +# Generated on 2022-09-06T19:01:35Z by kres 871f67c. ARG TOOLCHAIN @@ -10,9 +10,9 @@ ARG TOOLCHAIN FROM scratch AS generate # runs markdownlint -FROM node:18.2.0-alpine AS lint-markdown +FROM docker.io/node:18.8.0-alpine3.16 AS lint-markdown WORKDIR /src -RUN npm i -g markdownlint-cli@0.31.1 +RUN npm i -g markdownlint-cli@0.32.2 RUN npm i sentences-per-line@0.2.1 COPY .markdownlint.json . COPY ./README.md ./README.md @@ -23,12 +23,13 @@ FROM ${TOOLCHAIN} AS toolchain RUN apk --update --no-cache add bash curl build-base protoc protobuf-dev # build tools -FROM toolchain AS tools +FROM --platform=${BUILDPLATFORM} toolchain AS tools 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 @@ -56,7 +57,7 @@ RUN FILES="$(gofumpt -l .)" && test -z "${FILES}" || (echo -e "Source code is no # runs goimports FROM base AS lint-goimports -RUN FILES="$(goimports -l -local github.com/talos-systems/crypto .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/talos-systems/crypto .':\n${FILES}"; exit 1) +RUN FILES="$(goimports -l -local github.com/siderolabs/crypto .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/siderolabs/crypto .':\n${FILES}"; exit 1) # runs golangci-lint FROM base AS lint-golangci-lint diff --git a/Makefile b/Makefile index cb3cab4..25dc68c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2022-06-22T12:59:39Z by kres 65530e7. +# Generated on 2022-09-06T19:01:35Z by kres 871f67c. # common variables @@ -11,13 +11,13 @@ ARTIFACTS := _out REGISTRY ?= ghcr.io USERNAME ?= siderolabs REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME) -GOLANGCILINT_VERSION ?= v1.46.2 +GOLANGCILINT_VERSION ?= v1.49.0 GOFUMPT_VERSION ?= v0.3.1 -GO_VERSION ?= 1.18 -GOIMPORTS_VERSION ?= v0.1.10 -PROTOBUF_GO_VERSION ?= 1.28.0 +GO_VERSION ?= 1.19 +GOIMPORTS_VERSION ?= v0.1.12 +PROTOBUF_GO_VERSION ?= 1.28.1 GRPC_GO_VERSION ?= 1.2.0 -GRPC_GATEWAY_VERSION ?= 2.10.0 +GRPC_GATEWAY_VERSION ?= 2.11.3 VTPROTOBUF_VERSION ?= 0.3.0 DEEPCOPY_VERSION ?= v0.5.5 TESTPKGS ?= ./... @@ -39,6 +39,7 @@ COMMON_ARGS += --build-arg=ARTIFACTS=$(ARTIFACTS) COMMON_ARGS += --build-arg=SHA=$(SHA) COMMON_ARGS += --build-arg=TAG=$(TAG) COMMON_ARGS += --build-arg=USERNAME=$(USERNAME) +COMMON_ARGS += --build-arg=REGISTRY=$(REGISTRY) COMMON_ARGS += --build-arg=TOOLCHAIN=$(TOOLCHAIN) COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION=$(GOLANGCILINT_VERSION) COMMON_ARGS += --build-arg=GOFUMPT_VERSION=$(GOFUMPT_VERSION) @@ -49,7 +50,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 diff --git a/README.md b/README.md index ec7e15d..dc9bd14 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ github.com/talos-systems/crypto =============================== -[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/talos-systems/crypto)](https://pkg.go.dev/mod/github.com/talos-systems/crypto) +[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/siderolabs/crypto)](https://pkg.go.dev/mod/github.com/siderolabs/crypto) Package provides wrappers around standard library `crypto/x509` and other `crypto/` packages to simplify the usage by providing some defaults and ready to use recipes. diff --git a/go.mod b/go.mod index 9ad9d90..efea7e2 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ -module github.com/talos-systems/crypto +module github.com/siderolabs/crypto -go 1.18 +go 1.19 require ( github.com/stretchr/testify v1.7.3 diff --git a/tls/provider.go b/tls/provider.go index 01babfa..f99259a 100644 --- a/tls/provider.go +++ b/tls/provider.go @@ -14,7 +14,7 @@ import ( "sync" "time" - talosx509 "github.com/talos-systems/crypto/x509" + talosx509 "github.com/siderolabs/crypto/x509" ) // CertificateProvider describes an interface by which TLS certificates may be managed. diff --git a/x509/fingerprint_test.go b/x509/fingerprint_test.go index 4385923..730f801 100644 --- a/x509/fingerprint_test.go +++ b/x509/fingerprint_test.go @@ -10,7 +10,7 @@ import ( "encoding/pem" "testing" - "github.com/talos-systems/crypto/x509" + "github.com/siderolabs/crypto/x509" ) const certPEM1 = ` diff --git a/x509/x509.go b/x509/x509.go index 4459289..88c6abd 100644 --- a/x509/x509.go +++ b/x509/x509.go @@ -20,9 +20,9 @@ import ( "encoding/pem" "errors" "fmt" - "io/ioutil" "math/big" "net" + "os" "strings" "time" ) @@ -661,14 +661,14 @@ func NewKeyPair(ca *CertificateAuthority, setters ...Option) (*KeyPair, error) { func NewCertificateAndKeyFromFiles(crt, key string) (*PEMEncodedCertificateAndKey, error) { p := &PEMEncodedCertificateAndKey{} - crtBytes, err := ioutil.ReadFile(crt) + crtBytes, err := os.ReadFile(crt) if err != nil { return nil, err } p.Crt = crtBytes - keyBytes, err := ioutil.ReadFile(key) + keyBytes, err := os.ReadFile(key) if err != nil { return nil, err } diff --git a/x509/x509_test.go b/x509/x509_test.go index 02e7142..6e8f129 100644 --- a/x509/x509_test.go +++ b/x509/x509_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "gopkg.in/yaml.v3" - "github.com/talos-systems/crypto/x509" + "github.com/siderolabs/crypto/x509" ) func TestNewKeyPair(t *testing.T) {