From 24e8f2eb42039d794fc3a8e80e15660be1d506dc Mon Sep 17 00:00:00 2001 From: Ronald Ekambi Date: Wed, 9 Aug 2023 11:53:28 -0400 Subject: [PATCH] Repo maintance: - clean up dependencies - adding golangci lint - updating maintaining teams - allow release/** to build newer versions of consul-template going forward --- .golangci.yml | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ .release/ci.hcl | 9 +++++--- Dockerfile | 2 +- Makefile | 6 +++++ go.mod | 4 ---- 5 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 000000000..cde041c6b --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,61 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +linters: + disable-all: true + enable: + - gofmt + - govet + - unconvert + - staticcheck + - ineffassign + - unparam + - forbidigo + - gomodguard + - depguard + - gosimple + +issues: + # Disable the default exclude list so that all excludes are explicitly + # defined in this file. + exclude-use-default: false + +linters-settings: + govet: + check-shadowing: true + enable-all: true + disable: + - fieldalignment + - nilness + - shadow + - unusedwrite + gofmt: + simplify: true + forbidigo: + # Forbid the following identifiers (list of regexp). + forbid: + - '\bioutil\b(# Use io and os packages instead of ioutil)?' + - '\brequire\.New\b(# Use package-level functions with explicit TestingT)?' + - '\bassert\.New\b(# Use package-level functions with explicit TestingT)?' + # Exclude godoc examples from forbidigo checks. + # Default: true + exclude_godoc_examples: false + gomodguard: + blocked: + # List of blocked modules. + modules: + # Blocked module. + - github.com/hashicorp/go-msgpack: + recommendations: + - github.com/hashicorp/consul-net-rpc/go-msgpack + - github.com/golang/protobuf: + recommendations: + - google.golang.org/protobuf + depguard: + list-type: denylist + include-go-root: true + +run: + timeout: 10m + concurrency: 4 + skip-dirs-use-default: false \ No newline at end of file diff --git a/.release/ci.hcl b/.release/ci.hcl index e7f62f837..c5cb5b96f 100644 --- a/.release/ci.hcl +++ b/.release/ci.hcl @@ -5,14 +5,17 @@ schema = "1" project "consul-template" { // the team key is not used by CRT currently - team = "cat-floss" + team = "consul-core" slack { - notification_channel = "C026W707YHJ" + notification_channel = "C9KPKPKRN" } github { organization = "hashicorp" repository = "consul-template" - release_branches = ["main"] + release_branches = [ + "main", + "release/**", + ] } } diff --git a/Dockerfile b/Dockerfile index 5933eff2b..1fb571213 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ ARG PRODUCT_NAME=$BIN_NAME # TARGETARCH and TARGETOS are set automatically when --platform is provided. ARG TARGETOS TARGETARCH -LABEL maintainer="John Eikenberry " +LABEL maintainer="Consul Team " # version label is required for build process LABEL version=$PRODUCT_VERSION LABEL revision=$PRODUCT_REVISION diff --git a/Makefile b/Makefile index 3fc605330..6f31f9226 100644 --- a/Makefile +++ b/Makefile @@ -72,3 +72,9 @@ toc: dev-tree: @true .PHONY: dev-tree + +# lint +lint: + @echo "==> Running golangci-lint" + GOWORK=off golangci-lint run --build-tags '$(GOTAGS)' +.PHONY: lint \ No newline at end of file diff --git a/go.mod b/go.mod index 134941324..7606410fc 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,3 @@ require ( golang.org/x/time v0.3.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace github.com/golang/lint => golang.org/x/lint v0.0.0-20190409202823-959b441ac422 - -replace sourcegraph.com/sourcegraph/go-diff => github.com/sourcegraph/go-diff v0.5.1