Add make fmt CI check (#13803)
* Add make fmt CI check * Don't suppress patch output
This commit is contained in:
parent
fce9c92c5b
commit
5032cfaf47
|
@ -146,6 +146,7 @@ jobs:
|
|||
- CIRCLECI_CLI_VERSION: 0.1.5546
|
||||
- GO_TAGS: ''
|
||||
- GO_VERSION: 1.17.5
|
||||
- GOFUMPT_VERSION: 0.2.1
|
||||
- GOTESTSUM_VERSION: 0.5.2
|
||||
algolia-index:
|
||||
docker:
|
||||
|
@ -360,6 +361,46 @@ jobs:
|
|||
environment:
|
||||
- CIRCLECI_CLI_VERSION: 0.1.5546
|
||||
- GO_TAGS: ''
|
||||
fmt:
|
||||
machine: true
|
||||
shell: /usr/bin/env bash -euo pipefail -c
|
||||
working_directory: /home/circleci/go/src/github.com/hashicorp/vault
|
||||
steps:
|
||||
- run:
|
||||
command: |
|
||||
[ -n "$GO_VERSION" ] || { echo "You must set GO_VERSION"; exit 1; }
|
||||
# Install Go
|
||||
curl -sSLO "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz"
|
||||
sudo rm -rf /usr/local/go
|
||||
sudo tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz"
|
||||
rm -f "go${GO_VERSION}.linux-amd64.tar.gz"
|
||||
GOPATH="/home/circleci/go"
|
||||
mkdir $GOPATH 2>/dev/null || { sudo mkdir $GOPATH && sudo chmod 777 $GOPATH; }
|
||||
echo "export GOPATH='$GOPATH'" >> "$BASH_ENV"
|
||||
echo "export PATH='$PATH:$GOPATH/bin:/usr/local/go/bin'" >> "$BASH_ENV"
|
||||
echo "export GOPROXY=https://proxy.golang.org,direct" >> "$BASH_ENV"
|
||||
echo "export GOPRIVATE=github.com/hashicorp/*" >> "$BASH_ENV"
|
||||
|
||||
echo "$ go version"
|
||||
go version
|
||||
name: Setup Go
|
||||
working_directory: ~/
|
||||
- checkout
|
||||
- run:
|
||||
command: |
|
||||
go install "mvdan.cc/gofumpt@v${GOFUMPT_VERSION}"
|
||||
make fmt
|
||||
if ! git diff --exit-code; then
|
||||
echo "Code has formatting errors. Run 'make fmt' to fix"
|
||||
exit 1
|
||||
fi
|
||||
name: make fmt
|
||||
environment:
|
||||
- CIRCLECI_CLI_VERSION: 0.1.5546
|
||||
- GO_TAGS: ''
|
||||
- GO_VERSION: 1.17.5
|
||||
- GOFUMPT_VERSION: 0.2.1
|
||||
- GOTESTSUM_VERSION: 0.5.2
|
||||
test-go-race:
|
||||
docker:
|
||||
- image: docker.mirror.hashicorp.services/cimg/go:1.17.5
|
||||
|
@ -841,6 +882,7 @@ jobs:
|
|||
- CIRCLECI_CLI_VERSION: 0.1.5546
|
||||
- GO_TAGS: ''
|
||||
- GO_VERSION: 1.17.5
|
||||
- GOFUMPT_VERSION: 0.2.1
|
||||
- GOTESTSUM_VERSION: 0.5.2
|
||||
test-go-race-remote-docker:
|
||||
docker:
|
||||
|
@ -1043,6 +1085,7 @@ workflows:
|
|||
ci:
|
||||
jobs:
|
||||
- pre-flight-checks
|
||||
- fmt
|
||||
- install-ui-dependencies:
|
||||
requires:
|
||||
- pre-flight-checks
|
||||
|
|
|
@ -5,6 +5,7 @@ go-machine:
|
|||
CIRCLECI_CLI_VERSION: 0.1.5546 # Pin CircleCI CLI to patch version (ex: 1.2.3)
|
||||
GO_VERSION: 1.17.5 # Pin Go to patch version (ex: 1.2.3)
|
||||
GOTESTSUM_VERSION: 0.5.2 # Pin gotestsum to patch version (ex: 1.2.3)
|
||||
GOFUMPT_VERSION: 0.2.1 # Pin gofumpt to patch version (ex: 1.2.3)
|
||||
GO_TAGS: ""
|
||||
working_directory: /home/circleci/go/src/github.com/hashicorp/vault
|
||||
node:
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
description: Ensure go formatting is correct.
|
||||
executor: go-machine
|
||||
steps:
|
||||
# Setup Go enabling the proxy for downloading modules.
|
||||
- setup-go:
|
||||
GOPROXY: https://proxy.golang.org,direct
|
||||
- checkout
|
||||
- run:
|
||||
name: make fmt
|
||||
command: |
|
||||
go install "mvdan.cc/gofumpt@v${GOFUMPT_VERSION}"
|
||||
make fmt
|
||||
if ! git diff --exit-code; then
|
||||
echo "Code has formatting errors. Run 'make fmt' to fix"
|
||||
exit 1
|
||||
fi
|
|
@ -1,5 +1,6 @@
|
|||
jobs:
|
||||
- pre-flight-checks
|
||||
- fmt
|
||||
- install-ui-dependencies:
|
||||
requires:
|
||||
- pre-flight-checks
|
||||
|
|
|
@ -46,9 +46,7 @@ import (
|
|||
"golang.org/x/net/idna"
|
||||
)
|
||||
|
||||
var (
|
||||
stepCount = 0
|
||||
)
|
||||
var stepCount = 0
|
||||
|
||||
func TestPKI_RequireCN(t *testing.T) {
|
||||
coreConfig := &vault.CoreConfig{
|
||||
|
|
|
@ -5,9 +5,10 @@ package pki
|
|||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
|
||||
"github.com/hashicorp/vault/sdk/helper/certutil"
|
||||
"github.com/hashicorp/vault/sdk/logical"
|
||||
"io"
|
||||
)
|
||||
|
||||
var errEntOnly = errors.New("managed keys are supported within enterprise edition only")
|
||||
|
|
|
@ -181,7 +181,6 @@ func (b *backend) pathSetSignedIntermediate(ctx context.Context, req *logical.Re
|
|||
}
|
||||
|
||||
parsedCB, err := parseCABundle(ctx, b, req, cb)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -2,13 +2,14 @@ package pki
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hashicorp/vault/sdk/helper/errutil"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/vault/sdk/helper/errutil"
|
||||
)
|
||||
|
||||
const (
|
||||
managedKeyNameArg = "managed_key_name"
|
||||
managedKeyIdArg = "managed_key_id"
|
||||
managedKeyIdArg = "managed_key_id"
|
||||
)
|
||||
|
||||
func normalizeSerial(serial string) string {
|
||||
|
|
|
@ -216,8 +216,7 @@ func (m *MSSQL) revokeUserDefault(ctx context.Context, username string) error {
|
|||
|
||||
// Check if DB is contained
|
||||
if m.containedDB {
|
||||
revokeQuery :=
|
||||
`DECLARE @stmt nvarchar(max);
|
||||
revokeQuery := `DECLARE @stmt nvarchar(max);
|
||||
SET @stmt = 'DROP USER IF EXISTS ' + QuoteName(@username);
|
||||
EXEC(@stmt);`
|
||||
revokeStmt, err := db.PrepareContext(ctx, revokeQuery)
|
||||
|
@ -232,12 +231,11 @@ func (m *MSSQL) revokeUserDefault(ctx context.Context, username string) error {
|
|||
}
|
||||
|
||||
// First disable server login
|
||||
disableQuery :=
|
||||
`DECLARE @stmt nvarchar(max);
|
||||
disableQuery := `DECLARE @stmt nvarchar(max);
|
||||
SET @stmt = 'ALTER LOGIN ' + QuoteName(@username) + ' DISABLE';
|
||||
EXEC(@stmt);`
|
||||
disableStmt, err := db.PrepareContext(ctx, disableQuery)
|
||||
if err != nil{
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer disableStmt.Close()
|
||||
|
|
|
@ -169,7 +169,7 @@ type PrivateKeyExtractor func(c *CertBundle, parsedBundle *ParsedCertBundle) err
|
|||
func (c *CertBundle) ToParsedCertBundleWithExtractor(privateKeyExtractor PrivateKeyExtractor) (*ParsedCertBundle, error) {
|
||||
var err error
|
||||
var pemBlock *pem.Block
|
||||
var result = &ParsedCertBundle{}
|
||||
result := &ParsedCertBundle{}
|
||||
|
||||
err = privateKeyExtractor(c, result)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue