Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format golang imports using gci #301

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Run static checks
#
# These actions are skipped for draft PRs.
# See https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/19
name: lint
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
golangci-lint:
# See https://github.com/golangci/golangci-lint-action
# TODO(wallrj) Timeout is increased to 3m because the action sometimes takes
# a long time. Remove this when the upstream issue is resolved.
# See https://github.com/golangci/golangci-lint-action/issues/297
name: golangci-lint
runs-on: ubuntu-22.04
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
# Set up Go so that golangci-lint has the right $GOROOT and can find
# the right standard libraries. See:
# https://github.com/reviewdog/action-golangci-lint/issues/73#issuecomment-813386935
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- uses: golangci/[email protected]
with:
args: --verbose --timeout=3m
12 changes: 11 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ linters:
- varcheck
- unused
enable:
- gci
- gosec

issues:
Expand All @@ -26,4 +27,13 @@ issues:
- gosec
- text: "h.Write"
linters:
- errcheck
- errcheck

linters-settings:
gci:
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/Venafi/vcert) # Custom section: groups all imports with the specified Prefix.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
3 changes: 2 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ package vcert
import (
"crypto/x509"
"fmt"
"log"

"github.com/Venafi/vcert/v4/pkg/endpoint"
"github.com/Venafi/vcert/v4/pkg/venafi/cloud"
"github.com/Venafi/vcert/v4/pkg/venafi/fake"
"github.com/Venafi/vcert/v4/pkg/venafi/tpp"
"github.com/Venafi/vcert/v4/pkg/verror"
"log"
)

type newClientArgs struct {
Expand Down
5 changes: 3 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ import (
"crypto/x509/pkix"
"encoding/json"
"fmt"
"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"io/ioutil"
"net/http"
"os"
"testing"
"time"

"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/endpoint"
)

func init() {
Expand Down
14 changes: 7 additions & 7 deletions cmd/vcert/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import (
"encoding/json"
"encoding/pem"
"fmt"
"github.com/Venafi/vcert/v4/pkg/venafi/cloud"
"github.com/Venafi/vcert/v4/pkg/venafi/fake"
"github.com/Venafi/vcert/v4/pkg/venafi/tpp"
"io/ioutil"
"log"
"net"
Expand All @@ -34,15 +31,18 @@ import (
"strings"
"time"

"github.com/Venafi/vcert/v4/pkg/policy"
"github.com/Venafi/vcert/v4/pkg/util"
"github.com/urfave/cli/v2"
"golang.org/x/crypto/pkcs12"
"gopkg.in/yaml.v2"

"github.com/Venafi/vcert/v4"
"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"github.com/urfave/cli/v2"
"golang.org/x/crypto/pkcs12"
"github.com/Venafi/vcert/v4/pkg/policy"
"github.com/Venafi/vcert/v4/pkg/util"
"github.com/Venafi/vcert/v4/pkg/venafi/cloud"
"github.com/Venafi/vcert/v4/pkg/venafi/fake"
"github.com/Venafi/vcert/v4/pkg/venafi/tpp"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion cmd/vcert/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import (
"sort"
"time"

"github.com/Venafi/vcert/v4"
"github.com/urfave/cli/v2"

"github.com/Venafi/vcert/v4"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/vcert/result_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ import (
"encoding/json"
"encoding/pem"
"fmt"
"github.com/Venafi/vcert/v4/pkg/util"
"io/ioutil"
"os"
"strings"
"time"

"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/pavel-v-chernykh/keystore-go/v4"
"software.sslmate.com/src/go-pkcs12"

"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/util"
)

type Config struct {
Expand Down
3 changes: 2 additions & 1 deletion cmd/vcert/test_utils.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package main

import (
"github.com/urfave/cli/v2"
"os"

"github.com/urfave/cli/v2"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions cmd/vcert/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import (
"strings"
"time"

"github.com/spf13/viper"
"github.com/urfave/cli/v2"

"github.com/Venafi/vcert/v4"
"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"github.com/Venafi/vcert/v4/pkg/util"

"github.com/spf13/viper"
"github.com/urfave/cli/v2"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion cmd/vcert/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ package main
import (
"bufio"
"fmt"
"github.com/Venafi/vcert/v4/pkg/util"
"io/ioutil"
"os"
"regexp"
"strings"

"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/util"
)

// RevocationReasonOptions is an array of strings containing reasons for certificate revocation
Expand Down
3 changes: 2 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import (
"os/user"
"path/filepath"

"github.com/Venafi/vcert/v4/pkg/endpoint"
"gopkg.in/ini.v1"

"github.com/Venafi/vcert/v4/pkg/endpoint"
)

// Config is a basic structure for high level initiating connector to Trust Platform (TPP)/Venafi Cloud
Expand Down
5 changes: 3 additions & 2 deletions examples/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package main

import (
"fmt"
"github.com/Venafi/vcert/v4"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"io/ioutil"
"log"
"net/http"
"os"

"github.com/Venafi/vcert/v4"
"github.com/Venafi/vcert/v4/pkg/endpoint"
)

func main() {
Expand Down
9 changes: 5 additions & 4 deletions examples/simple-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ import (
"crypto/x509/pkix"
"encoding/pem"
"fmt"
"github.com/Venafi/vcert/v4"
"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"github.com/Venafi/vcert/v4/pkg/venafi/tpp"
"io/ioutil"
t "log"
"math/big"
"net"
"os"
"strings"
"time"

"github.com/Venafi/vcert/v4"
"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"github.com/Venafi/vcert/v4/pkg/venafi/tpp"
)

func main() {
Expand Down
7 changes: 4 additions & 3 deletions examples/simple-cli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ import (
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"github.com/Venafi/vcert/v4"
"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/test"
"net/http"
"testing"
"time"

"github.com/Venafi/vcert/v4"
"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/test"
)

var effectiveConfig *vcert.Config
Expand Down
5 changes: 3 additions & 2 deletions examples/simple-cli/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ package main
import (
"encoding/json"
"fmt"
"github.com/Venafi/vcert/v4"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"io/ioutil"
"log"
"os"

"github.com/Venafi/vcert/v4"
"github.com/Venafi/vcert/v4/pkg/endpoint"
)

var mockConfig, cloudConfig, tppConfig *vcert.Config
Expand Down
21 changes: 20 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module github.com/Venafi/vcert/v4

go 1.18

require (
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c
github.com/pavel-v-chernykh/keystore-go/v4 v4.1.0
Expand All @@ -13,4 +15,21 @@ require (
software.sslmate.com/src/go-pkcs12 v0.0.0-20180114231543-2291e8f0f237
)

go 1.13
require (
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/fsnotify/fsnotify v1.4.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/spf13/afero v1.1.2 // indirect
github.com/spf13/cast v1.3.0 // indirect
github.com/spf13/jwalterweatherman v1.0.0 // indirect
github.com/spf13/pflag v1.0.3 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
golang.org/x/text v0.3.3 // indirect
)
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down
7 changes: 4 additions & 3 deletions listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"crypto/tls"
"crypto/x509/pkix"
"fmt"
"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"github.com/Venafi/vcert/v4/pkg/util"
"log"
"net"
"time"

"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"github.com/Venafi/vcert/v4/pkg/util"
)

// NewListener returns a net.Listener that listens on the first port
Expand Down
5 changes: 3 additions & 2 deletions listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"github.com/Venafi/vcert/v4/pkg/endpoint"
"github.com/Venafi/vcert/v4/pkg/venafi/fake"
"io/ioutil"
"net/http"
"testing"
"time"

"github.com/Venafi/vcert/v4/pkg/endpoint"
"github.com/Venafi/vcert/v4/pkg/venafi/fake"
)

func TestConfig_NewListener(t *testing.T) {
Expand Down
7 changes: 3 additions & 4 deletions pkg/certificate/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ import (
"fmt"
"net"
"net/url"
"reflect"
"sort"
"strings"
"time"

"github.com/Venafi/vcert/v4/pkg/util"
"github.com/youmark/pkcs8"

"reflect"
"sort"

"github.com/Venafi/vcert/v4/pkg/util"
"github.com/Venafi/vcert/v4/pkg/verror"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/certificate/certificateCollection.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"github.com/Venafi/vcert/v4/pkg/verror"
"strings"

"github.com/Venafi/vcert/v4/pkg/verror"
)

// ChainOption represents the options to be used with the certificate chain
Expand Down
3 changes: 1 addition & 2 deletions pkg/endpoint/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ import (
"regexp"
"time"

"github.com/Venafi/vcert/v4/pkg/policy"

"github.com/Venafi/vcert/v4/pkg/certificate"
"github.com/Venafi/vcert/v4/pkg/policy"
)

const SDKName = "Venafi VCert-Go"
Expand Down
3 changes: 2 additions & 1 deletion pkg/endpoint/endpoint_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package endpoint

import (
"crypto/x509/pkix"
"github.com/Venafi/vcert/v4/pkg/certificate"
"testing"

"github.com/Venafi/vcert/v4/pkg/certificate"
)

var any = []string{`.*`}
Expand Down
Loading