From b48c534722ebb25eed1e48498436be06b5280a61 Mon Sep 17 00:00:00 2001 From: Patrick East Date: Sat, 21 Sep 2019 15:10:05 -0700 Subject: [PATCH] Run `make fmt` with new goimports cmd Signed-off-by: Patrick East --- ast/term.go | 3 ++- cmd/build.go | 3 ++- cmd/check.go | 3 ++- cmd/deps.go | 5 +++-- cmd/eval.go | 5 +++-- cmd/flags.go | 3 ++- cmd/fmt.go | 3 ++- cmd/parse.go | 3 ++- cmd/test.go | 3 ++- cmd/version.go | 3 ++- download/download.go | 5 +++-- internal/compiler/wasm/wasm.go | 3 ++- internal/presentation/presentation.go | 1 + internal/prometheus/prometheus.go | 3 ++- internal/wasm/encoding/reader.go | 3 ++- main.go | 9 ++++++--- plugins/bundle/config.go | 5 +++-- plugins/bundle/config_test.go | 3 ++- plugins/bundle/plugin.go | 3 ++- plugins/bundle/status.go | 3 ++- plugins/discovery/discovery.go | 3 ++- plugins/logs/plugin.go | 5 +++-- plugins/rest/rest.go | 3 ++- plugins/rest/rest_test.go | 3 ++- plugins/status/plugin.go | 5 +++-- repl/repl.go | 3 ++- runtime/config.go | 1 + runtime/logging.go | 3 ++- runtime/runtime.go | 7 ++++--- server/server.go | 3 ++- server/server_test.go | 3 ++- test/e2e/testing.go | 3 ++- test/wasm/cmd/testgen.go | 5 +++-- topdown/binary.go | 6 ++++-- topdown/casts_test.go | 3 ++- topdown/http.go | 3 ++- topdown/http_test.go | 3 ++- topdown/internal/jwx/jwa/key_type.go | 3 ++- topdown/internal/jwx/jwa/parameters.go | 1 + topdown/internal/jwx/jwa/signature.go | 3 ++- topdown/internal/jwx/jwk/ecdsa.go | 3 ++- topdown/internal/jwx/jwk/headers.go | 3 ++- topdown/internal/jwx/jwk/interface.go | 1 + topdown/internal/jwx/jwk/jwk.go | 3 ++- topdown/internal/jwx/jwk/key_ops.go | 1 + topdown/internal/jwx/jwk/rsa.go | 3 ++- topdown/internal/jwx/jwk/symmetric.go | 3 ++- topdown/internal/jwx/jws/headers.go | 3 ++- topdown/internal/jwx/jws/jws.go | 3 ++- topdown/internal/jwx/jws/sign/ecdsa.go | 1 + topdown/internal/jwx/jws/sign/ecdsa_test.go | 3 ++- topdown/internal/jwx/jws/sign/hmac.go | 3 ++- topdown/internal/jwx/jws/sign/hmac_test.go | 3 ++- topdown/internal/jwx/jws/sign/interface.go | 1 + topdown/internal/jwx/jws/sign/rsa.go | 1 + topdown/internal/jwx/jws/sign/sign.go | 3 ++- topdown/internal/jwx/jws/verify/ecdsa.go | 3 ++- topdown/internal/jwx/jws/verify/ecdsa_test.go | 3 ++- topdown/internal/jwx/jws/verify/hmac.go | 4 +++- topdown/internal/jwx/jws/verify/hmac_test.go | 3 ++- topdown/internal/jwx/jws/verify/interface.go | 1 + topdown/internal/jwx/jws/verify/rsa.go | 1 + topdown/internal/jwx/jws/verify/rsa_test.go | 3 ++- topdown/internal/jwx/jws/verify/verify.go | 3 ++- util/hashmap.go | 6 ++++-- 65 files changed, 138 insertions(+), 68 deletions(-) diff --git a/ast/term.go b/ast/term.go index 28b7ca86da..61c47af22c 100644 --- a/ast/term.go +++ b/ast/term.go @@ -17,8 +17,9 @@ import ( "strings" "github.com/OneOfOne/xxhash" - "github.com/open-policy-agent/opa/util" "github.com/pkg/errors" + + "github.com/open-policy-agent/opa/util" ) var errFindNotFound = fmt.Errorf("find: not found") diff --git a/cmd/build.go b/cmd/build.go index 1a2d79a49e..2b1a93138a 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -9,8 +9,9 @@ import ( "fmt" "os" - "github.com/open-policy-agent/opa/rego" "github.com/spf13/cobra" + + "github.com/open-policy-agent/opa/rego" ) var buildParams = struct { diff --git a/cmd/check.go b/cmd/check.go index 30bd780edd..394667889d 100644 --- a/cmd/check.go +++ b/cmd/check.go @@ -9,10 +9,11 @@ import ( "fmt" "os" + "github.com/spf13/cobra" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/loader" "github.com/open-policy-agent/opa/util" - "github.com/spf13/cobra" ) var checkParams = struct { diff --git a/cmd/deps.go b/cmd/deps.go index 06248e8b1b..ad275cf9fe 100644 --- a/cmd/deps.go +++ b/cmd/deps.go @@ -11,11 +11,12 @@ import ( "github.com/open-policy-agent/opa/dependencies" "github.com/open-policy-agent/opa/internal/presentation" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/loader" "github.com/open-policy-agent/opa/util" - "github.com/pkg/errors" - "github.com/spf13/cobra" ) type depsCommandParams struct { diff --git a/cmd/eval.go b/cmd/eval.go index d29d5f3360..978852db72 100644 --- a/cmd/eval.go +++ b/cmd/eval.go @@ -13,6 +13,9 @@ import ( "strconv" "strings" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/cover" fileurl "github.com/open-policy-agent/opa/internal/file/url" @@ -24,8 +27,6 @@ import ( "github.com/open-policy-agent/opa/topdown" "github.com/open-policy-agent/opa/topdown/lineage" "github.com/open-policy-agent/opa/util" - "github.com/pkg/errors" - "github.com/spf13/cobra" ) type evalCommandParams struct { diff --git a/cmd/flags.go b/cmd/flags.go index f925872022..7d73468d3b 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -5,9 +5,10 @@ package cmd import ( + "github.com/spf13/pflag" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/util" - "github.com/spf13/pflag" ) func setMaxErrors(fs *pflag.FlagSet, errLimit *int) { diff --git a/cmd/fmt.go b/cmd/fmt.go index 83556c45ab..6959c4563c 100644 --- a/cmd/fmt.go +++ b/cmd/fmt.go @@ -13,9 +13,10 @@ import ( "os/exec" "path/filepath" + "github.com/spf13/cobra" + "github.com/open-policy-agent/opa/format" fileurl "github.com/open-policy-agent/opa/internal/file/url" - "github.com/spf13/cobra" ) var fmtParams = struct { diff --git a/cmd/parse.go b/cmd/parse.go index 90a6b8a97d..054421f47d 100644 --- a/cmd/parse.go +++ b/cmd/parse.go @@ -9,10 +9,11 @@ import ( "fmt" "os" + "github.com/spf13/cobra" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/loader" "github.com/open-policy-agent/opa/util" - "github.com/spf13/cobra" ) const ( diff --git a/cmd/test.go b/cmd/test.go index 1b8b49c7ee..ac4adbf45e 100644 --- a/cmd/test.go +++ b/cmd/test.go @@ -18,12 +18,13 @@ import ( "github.com/open-policy-agent/opa/storage" "github.com/open-policy-agent/opa/topdown/lineage" + "github.com/spf13/cobra" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/cover" "github.com/open-policy-agent/opa/tester" "github.com/open-policy-agent/opa/topdown" "github.com/open-policy-agent/opa/util" - "github.com/spf13/cobra" ) const ( diff --git a/cmd/version.go b/cmd/version.go index d9a397f17e..576b912b01 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -7,8 +7,9 @@ package cmd import ( "fmt" - "github.com/open-policy-agent/opa/version" "github.com/spf13/cobra" + + "github.com/open-policy-agent/opa/version" ) func init() { diff --git a/download/download.go b/download/download.go index a2a3dbc376..3ebc51dc95 100644 --- a/download/download.go +++ b/download/download.go @@ -12,11 +12,12 @@ import ( "net/http" "time" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/open-policy-agent/opa/bundle" "github.com/open-policy-agent/opa/plugins/rest" "github.com/open-policy-agent/opa/util" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) const ( diff --git a/internal/compiler/wasm/wasm.go b/internal/compiler/wasm/wasm.go index 45dbb33a3d..cebb061704 100644 --- a/internal/compiler/wasm/wasm.go +++ b/internal/compiler/wasm/wasm.go @@ -10,13 +10,14 @@ import ( "fmt" "strings" + "github.com/pkg/errors" + "github.com/open-policy-agent/opa/internal/compiler/wasm/opa" "github.com/open-policy-agent/opa/internal/ir" "github.com/open-policy-agent/opa/internal/wasm/encoding" "github.com/open-policy-agent/opa/internal/wasm/instruction" "github.com/open-policy-agent/opa/internal/wasm/module" "github.com/open-policy-agent/opa/internal/wasm/types" - "github.com/pkg/errors" ) const ( diff --git a/internal/presentation/presentation.go b/internal/presentation/presentation.go index ae159ba5a3..ba719295ca 100644 --- a/internal/presentation/presentation.go +++ b/internal/presentation/presentation.go @@ -17,6 +17,7 @@ import ( "time" "github.com/olekukonko/tablewriter" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/cover" "github.com/open-policy-agent/opa/format" diff --git a/internal/prometheus/prometheus.go b/internal/prometheus/prometheus.go index 0c7f1abe00..a545461801 100644 --- a/internal/prometheus/prometheus.go +++ b/internal/prometheus/prometheus.go @@ -11,9 +11,10 @@ import ( "net/http" "strconv" - "github.com/open-policy-agent/opa/metrics" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" + + "github.com/open-policy-agent/opa/metrics" ) // Provider wraps a metrics.Metrics provider with a Prometheus registry that can diff --git a/internal/wasm/encoding/reader.go b/internal/wasm/encoding/reader.go index 4f9a314102..3a02457afc 100644 --- a/internal/wasm/encoding/reader.go +++ b/internal/wasm/encoding/reader.go @@ -10,13 +10,14 @@ import ( "fmt" "io" + "github.com/pkg/errors" + "github.com/open-policy-agent/opa/internal/leb128" "github.com/open-policy-agent/opa/internal/wasm/constant" "github.com/open-policy-agent/opa/internal/wasm/instruction" "github.com/open-policy-agent/opa/internal/wasm/module" "github.com/open-policy-agent/opa/internal/wasm/opcode" "github.com/open-policy-agent/opa/internal/wasm/types" - "github.com/pkg/errors" ) // ReadModule reads a binary-encoded WASM module from r. diff --git a/main.go b/main.go index f66e817185..2a80f58257 100644 --- a/main.go +++ b/main.go @@ -4,9 +4,12 @@ package main -import "fmt" -import "os" -import "github.com/open-policy-agent/opa/cmd" +import ( + "fmt" + "os" + + "github.com/open-policy-agent/opa/cmd" +) func main() { if err := cmd.RootCommand.Execute(); err != nil { diff --git a/plugins/bundle/config.go b/plugins/bundle/config.go index d926b46fa6..5831557435 100644 --- a/plugins/bundle/config.go +++ b/plugins/bundle/config.go @@ -6,10 +6,11 @@ package bundle import ( "fmt" - "github.com/open-policy-agent/opa/download" - "github.com/open-policy-agent/opa/util" "path" "strings" + + "github.com/open-policy-agent/opa/download" + "github.com/open-policy-agent/opa/util" ) // ParseConfig validates the config and injects default values. This is diff --git a/plugins/bundle/config_test.go b/plugins/bundle/config_test.go index 277c53ae35..c076fb3816 100644 --- a/plugins/bundle/config_test.go +++ b/plugins/bundle/config_test.go @@ -6,8 +6,9 @@ package bundle import ( "fmt" - "gopkg.in/yaml.v2" "testing" + + "gopkg.in/yaml.v2" ) func TestConfigValidation(t *testing.T) { diff --git a/plugins/bundle/plugin.go b/plugins/bundle/plugin.go index ac366e1801..93e09cd4a8 100644 --- a/plugins/bundle/plugin.go +++ b/plugins/bundle/plugin.go @@ -16,11 +16,12 @@ import ( "github.com/open-policy-agent/opa/ast" + "github.com/sirupsen/logrus" + "github.com/open-policy-agent/opa/bundle" "github.com/open-policy-agent/opa/download" "github.com/open-policy-agent/opa/plugins" "github.com/open-policy-agent/opa/storage" - "github.com/sirupsen/logrus" ) // Plugin implements bundle activation. diff --git a/plugins/bundle/status.go b/plugins/bundle/status.go index d00c4bdd6f..a477651db3 100644 --- a/plugins/bundle/status.go +++ b/plugins/bundle/status.go @@ -7,9 +7,10 @@ package bundle import ( "time" + "github.com/pkg/errors" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/server/types" - "github.com/pkg/errors" ) const ( diff --git a/plugins/discovery/discovery.go b/plugins/discovery/discovery.go index f67fac63c9..e4042ca59a 100644 --- a/plugins/discovery/discovery.go +++ b/plugins/discovery/discovery.go @@ -12,6 +12,8 @@ import ( "github.com/open-policy-agent/opa/metrics" + "github.com/sirupsen/logrus" + "github.com/open-policy-agent/opa/ast" bundleApi "github.com/open-policy-agent/opa/bundle" "github.com/open-policy-agent/opa/config" @@ -22,7 +24,6 @@ import ( "github.com/open-policy-agent/opa/plugins/status" "github.com/open-policy-agent/opa/rego" "github.com/open-policy-agent/opa/storage/inmem" - "github.com/sirupsen/logrus" ) // Discovery implements configuration discovery for OPA. When discovery is diff --git a/plugins/logs/plugin.go b/plugins/logs/plugin.go index d657e8a83d..11584dd329 100644 --- a/plugins/logs/plugin.go +++ b/plugins/logs/plugin.go @@ -16,6 +16,9 @@ import ( "sync" "time" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/plugins" "github.com/open-policy-agent/opa/plugins/rest" @@ -23,8 +26,6 @@ import ( "github.com/open-policy-agent/opa/server" "github.com/open-policy-agent/opa/storage" "github.com/open-policy-agent/opa/util" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) // Logger defines the interface for decision logging plugins. diff --git a/plugins/rest/rest.go b/plugins/rest/rest.go index b196a0992e..27396caa89 100644 --- a/plugins/rest/rest.go +++ b/plugins/rest/rest.go @@ -10,12 +10,13 @@ import ( "context" "encoding/json" "errors" - "github.com/open-policy-agent/opa/internal/version" "io" "net/http" "reflect" "strings" + "github.com/open-policy-agent/opa/internal/version" + "github.com/sirupsen/logrus" "github.com/open-policy-agent/opa/util" diff --git a/plugins/rest/rest_test.go b/plugins/rest/rest_test.go index 3087fa90f2..0d21b2731b 100755 --- a/plugins/rest/rest_test.go +++ b/plugins/rest/rest_test.go @@ -8,13 +8,14 @@ import ( "context" "crypto/tls" "fmt" - "github.com/open-policy-agent/opa/internal/version" "io/ioutil" "net/http" "net/http/httptest" "os" "strings" "testing" + + "github.com/open-policy-agent/opa/internal/version" ) func TestNew(t *testing.T) { diff --git a/plugins/status/plugin.go b/plugins/status/plugin.go index 3427126d6a..15aa3c67b1 100644 --- a/plugins/status/plugin.go +++ b/plugins/status/plugin.go @@ -11,12 +11,13 @@ import ( "net/http" "reflect" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/open-policy-agent/opa/metrics" "github.com/open-policy-agent/opa/plugins" "github.com/open-policy-agent/opa/plugins/bundle" "github.com/open-policy-agent/opa/util" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) // UpdateRequestV1 represents the status update message that OPA sends to diff --git a/repl/repl.go b/repl/repl.go index a38b9976b5..50c3734fc1 100644 --- a/repl/repl.go +++ b/repl/repl.go @@ -16,6 +16,8 @@ import ( "strconv" "strings" + "github.com/peterh/liner" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/format" pr "github.com/open-policy-agent/opa/internal/presentation" @@ -25,7 +27,6 @@ import ( "github.com/open-policy-agent/opa/storage" "github.com/open-policy-agent/opa/topdown" "github.com/open-policy-agent/opa/topdown/lineage" - "github.com/peterh/liner" ) // REPL represents an instance of the interactive shell. diff --git a/runtime/config.go b/runtime/config.go index 2762c8d705..b207776671 100644 --- a/runtime/config.go +++ b/runtime/config.go @@ -12,6 +12,7 @@ import ( "strings" "github.com/ghodss/yaml" + "github.com/open-policy-agent/opa/internal/strvals" ) diff --git a/runtime/logging.go b/runtime/logging.go index d92571c0f6..31e4ca4c19 100644 --- a/runtime/logging.go +++ b/runtime/logging.go @@ -20,8 +20,9 @@ import ( "io/ioutil" - "github.com/open-policy-agent/opa/server/types" "github.com/sirupsen/logrus" + + "github.com/open-policy-agent/opa/server/types" ) func loggingEnabled(level logrus.Level) bool { diff --git a/runtime/runtime.go b/runtime/runtime.go index 611b1c522a..d92e5c39e7 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -20,6 +20,10 @@ import ( "github.com/open-policy-agent/opa/bundle" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "gopkg.in/fsnotify.v1" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/internal/prometheus" "github.com/open-policy-agent/opa/internal/runtime" @@ -34,9 +38,6 @@ import ( "github.com/open-policy-agent/opa/storage" "github.com/open-policy-agent/opa/storage/inmem" "github.com/open-policy-agent/opa/version" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - "gopkg.in/fsnotify.v1" ) var ( diff --git a/server/server.go b/server/server.go index 2fefbbf2a2..943c04c57d 100644 --- a/server/server.go +++ b/server/server.go @@ -26,6 +26,8 @@ import ( "time" "github.com/gorilla/mux" + "github.com/pkg/errors" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/bundle" "github.com/open-policy-agent/opa/metrics" @@ -42,7 +44,6 @@ import ( "github.com/open-policy-agent/opa/util" "github.com/open-policy-agent/opa/version" "github.com/open-policy-agent/opa/watch" - "github.com/pkg/errors" ) // AuthenticationScheme enumerates the supported authentication schemes. The diff --git a/server/server_test.go b/server/server_test.go index 8bfe1b0551..e9c95060ce 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -24,6 +24,8 @@ import ( "testing" "time" + "github.com/pkg/errors" + "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/bundle" "github.com/open-policy-agent/opa/metrics" @@ -36,7 +38,6 @@ import ( "github.com/open-policy-agent/opa/util" "github.com/open-policy-agent/opa/util/test" "github.com/open-policy-agent/opa/version" - "github.com/pkg/errors" ) type tr struct { diff --git a/test/e2e/testing.go b/test/e2e/testing.go index d716fc0bb9..e579bb042c 100644 --- a/test/e2e/testing.go +++ b/test/e2e/testing.go @@ -19,9 +19,10 @@ import ( "testing" "time" + "github.com/sirupsen/logrus" + "github.com/open-policy-agent/opa/runtime" "github.com/open-policy-agent/opa/util" - "github.com/sirupsen/logrus" ) const ( diff --git a/test/wasm/cmd/testgen.go b/test/wasm/cmd/testgen.go index 92e0a0c396..b13ecbca13 100644 --- a/test/wasm/cmd/testgen.go +++ b/test/wasm/cmd/testgen.go @@ -17,10 +17,11 @@ import ( "path/filepath" "strings" - "github.com/open-policy-agent/opa/rego" - "github.com/open-policy-agent/opa/util" "github.com/pkg/errors" "github.com/spf13/cobra" + + "github.com/open-policy-agent/opa/rego" + "github.com/open-policy-agent/opa/util" ) type params struct { diff --git a/topdown/binary.go b/topdown/binary.go index 19903450d5..3cab5def1e 100644 --- a/topdown/binary.go +++ b/topdown/binary.go @@ -4,8 +4,10 @@ package topdown -import "github.com/open-policy-agent/opa/ast" -import "github.com/open-policy-agent/opa/topdown/builtins" +import ( + "github.com/open-policy-agent/opa/ast" + "github.com/open-policy-agent/opa/topdown/builtins" +) func builtinBinaryAnd(a ast.Value, b ast.Value) (ast.Value, error) { diff --git a/topdown/casts_test.go b/topdown/casts_test.go index fe6b1f17bf..31cf536f8b 100644 --- a/topdown/casts_test.go +++ b/topdown/casts_test.go @@ -6,8 +6,9 @@ package topdown import ( "fmt" - "github.com/open-policy-agent/opa/ast" "testing" + + "github.com/open-policy-agent/opa/ast" ) func TestToArray(t *testing.T) { diff --git a/topdown/http.go b/topdown/http.go index 849afc2b96..f1b3d6a0b4 100644 --- a/topdown/http.go +++ b/topdown/http.go @@ -9,11 +9,12 @@ import ( "crypto/tls" "encoding/json" "fmt" - "github.com/open-policy-agent/opa/internal/version" "io" "io/ioutil" "strconv" + "github.com/open-policy-agent/opa/internal/version" + "net/http" "os" "strings" diff --git a/topdown/http_test.go b/topdown/http_test.go index 91e52446cb..21decbd6a6 100644 --- a/topdown/http_test.go +++ b/topdown/http_test.go @@ -10,7 +10,6 @@ import ( "crypto/x509" "encoding/json" "fmt" - "github.com/open-policy-agent/opa/internal/version" "io/ioutil" "net/http" "net/http/httptest" @@ -18,6 +17,8 @@ import ( "strings" "testing" + "github.com/open-policy-agent/opa/internal/version" + "github.com/open-policy-agent/opa/ast" ) diff --git a/topdown/internal/jwx/jwa/key_type.go b/topdown/internal/jwx/jwa/key_type.go index a061b5355a..076bd39ed7 100644 --- a/topdown/internal/jwx/jwa/key_type.go +++ b/topdown/internal/jwx/jwa/key_type.go @@ -1,8 +1,9 @@ package jwa import ( - "github.com/pkg/errors" "strconv" + + "github.com/pkg/errors" ) // KeyType represents the key type ("kty") that are supported diff --git a/topdown/internal/jwx/jwa/parameters.go b/topdown/internal/jwx/jwa/parameters.go index 9ddeee0ca9..63c5a6462e 100644 --- a/topdown/internal/jwx/jwa/parameters.go +++ b/topdown/internal/jwx/jwa/parameters.go @@ -2,6 +2,7 @@ package jwa import ( "crypto/elliptic" + "github.com/open-policy-agent/opa/topdown/internal/jwx/buffer" ) diff --git a/topdown/internal/jwx/jwa/signature.go b/topdown/internal/jwx/jwa/signature.go index 345455dd99..a0988ecabf 100644 --- a/topdown/internal/jwx/jwa/signature.go +++ b/topdown/internal/jwx/jwa/signature.go @@ -1,8 +1,9 @@ package jwa import ( - "github.com/pkg/errors" "strconv" + + "github.com/pkg/errors" ) // SignatureAlgorithm represents the various signature algorithms as described in https://tools.ietf.org/html/rfc7518#section-3.1 diff --git a/topdown/internal/jwx/jwk/ecdsa.go b/topdown/internal/jwx/jwk/ecdsa.go index 323fb48f4a..7bff2bf8e8 100644 --- a/topdown/internal/jwx/jwk/ecdsa.go +++ b/topdown/internal/jwx/jwk/ecdsa.go @@ -5,8 +5,9 @@ import ( "crypto/elliptic" "math/big" - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) func newECDSAPublicKey(key *ecdsa.PublicKey) (*ECDSAPublicKey, error) { diff --git a/topdown/internal/jwx/jwk/headers.go b/topdown/internal/jwx/jwk/headers.go index aa46b68c0d..8f310a4c12 100644 --- a/topdown/internal/jwx/jwk/headers.go +++ b/topdown/internal/jwx/jwk/headers.go @@ -1,8 +1,9 @@ package jwk import ( - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) // Convenience constants for common JWK parameters diff --git a/topdown/internal/jwx/jwk/interface.go b/topdown/internal/jwx/jwk/interface.go index e35304b58e..f718bec674 100644 --- a/topdown/internal/jwx/jwk/interface.go +++ b/topdown/internal/jwx/jwk/interface.go @@ -3,6 +3,7 @@ package jwk import ( "crypto/ecdsa" "crypto/rsa" + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) diff --git a/topdown/internal/jwx/jwk/jwk.go b/topdown/internal/jwx/jwk/jwk.go index 34cb2fce91..18835cbb36 100644 --- a/topdown/internal/jwx/jwk/jwk.go +++ b/topdown/internal/jwx/jwk/jwk.go @@ -6,8 +6,9 @@ import ( "crypto/rsa" "encoding/json" - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) // GetPublicKey returns the public key based on the private key type. diff --git a/topdown/internal/jwx/jwk/key_ops.go b/topdown/internal/jwx/jwk/key_ops.go index c4960c17da..f9c7a46398 100644 --- a/topdown/internal/jwx/jwk/key_ops.go +++ b/topdown/internal/jwx/jwk/key_ops.go @@ -3,6 +3,7 @@ package jwk import ( "encoding/json" "fmt" + "github.com/pkg/errors" ) diff --git a/topdown/internal/jwx/jwk/rsa.go b/topdown/internal/jwx/jwk/rsa.go index 45cf133d0c..e15e907d51 100644 --- a/topdown/internal/jwx/jwk/rsa.go +++ b/topdown/internal/jwx/jwk/rsa.go @@ -4,8 +4,9 @@ import ( "crypto/rsa" "math/big" - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) func newRSAPublicKey(key *rsa.PublicKey) (*RSAPublicKey, error) { diff --git a/topdown/internal/jwx/jwk/symmetric.go b/topdown/internal/jwx/jwk/symmetric.go index 08fb055972..6d1da1e400 100644 --- a/topdown/internal/jwx/jwk/symmetric.go +++ b/topdown/internal/jwx/jwk/symmetric.go @@ -1,8 +1,9 @@ package jwk import ( - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) func newSymmetricKey(key []byte) (*SymmetricKey, error) { diff --git a/topdown/internal/jwx/jws/headers.go b/topdown/internal/jwx/jws/headers.go index 38ad7cb9a5..fd6ffbe0e7 100644 --- a/topdown/internal/jwx/jws/headers.go +++ b/topdown/internal/jwx/jws/headers.go @@ -1,8 +1,9 @@ package jws import ( - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) // Constants for JWS Common parameters diff --git a/topdown/internal/jwx/jws/jws.go b/topdown/internal/jwx/jws/jws.go index 1391882031..34e18a499f 100644 --- a/topdown/internal/jwx/jws/jws.go +++ b/topdown/internal/jwx/jws/jws.go @@ -23,11 +23,12 @@ import ( "bytes" "encoding/base64" "encoding/json" + "strings" + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/open-policy-agent/opa/topdown/internal/jwx/jwk" "github.com/open-policy-agent/opa/topdown/internal/jwx/jws/sign" "github.com/open-policy-agent/opa/topdown/internal/jwx/jws/verify" - "strings" "github.com/pkg/errors" ) diff --git a/topdown/internal/jwx/jws/sign/ecdsa.go b/topdown/internal/jwx/jws/sign/ecdsa.go index 056a3bddbe..02fc9f0223 100644 --- a/topdown/internal/jwx/jws/sign/ecdsa.go +++ b/topdown/internal/jwx/jws/sign/ecdsa.go @@ -4,6 +4,7 @@ import ( "crypto" "crypto/ecdsa" "crypto/rand" + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" diff --git a/topdown/internal/jwx/jws/sign/ecdsa_test.go b/topdown/internal/jwx/jws/sign/ecdsa_test.go index 3a80e0cfa5..8076510b1f 100644 --- a/topdown/internal/jwx/jws/sign/ecdsa_test.go +++ b/topdown/internal/jwx/jws/sign/ecdsa_test.go @@ -1,8 +1,9 @@ package sign import ( - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "testing" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) func TestECDSASign(t *testing.T) { diff --git a/topdown/internal/jwx/jws/sign/hmac.go b/topdown/internal/jwx/jws/sign/hmac.go index e8b8dbfef0..f86283efba 100644 --- a/topdown/internal/jwx/jws/sign/hmac.go +++ b/topdown/internal/jwx/jws/sign/hmac.go @@ -4,9 +4,10 @@ import ( "crypto/hmac" "crypto/sha256" "crypto/sha512" - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "hash" + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" + "github.com/pkg/errors" ) diff --git a/topdown/internal/jwx/jws/sign/hmac_test.go b/topdown/internal/jwx/jws/sign/hmac_test.go index 95f8383dca..6b24cf8948 100644 --- a/topdown/internal/jwx/jws/sign/hmac_test.go +++ b/topdown/internal/jwx/jws/sign/hmac_test.go @@ -1,8 +1,9 @@ package sign import ( - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "testing" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) func TestHMACSign(t *testing.T) { diff --git a/topdown/internal/jwx/jws/sign/interface.go b/topdown/internal/jwx/jws/sign/interface.go index 2367a2974a..c79fd3e935 100644 --- a/topdown/internal/jwx/jws/sign/interface.go +++ b/topdown/internal/jwx/jws/sign/interface.go @@ -3,6 +3,7 @@ package sign import ( "crypto/ecdsa" "crypto/rsa" + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) diff --git a/topdown/internal/jwx/jws/sign/rsa.go b/topdown/internal/jwx/jws/sign/rsa.go index 392423f204..d9cc13af90 100644 --- a/topdown/internal/jwx/jws/sign/rsa.go +++ b/topdown/internal/jwx/jws/sign/rsa.go @@ -4,6 +4,7 @@ import ( "crypto" "crypto/rand" "crypto/rsa" + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" diff --git a/topdown/internal/jwx/jws/sign/sign.go b/topdown/internal/jwx/jws/sign/sign.go index 4a3d14ecb9..fd4b0645f2 100644 --- a/topdown/internal/jwx/jws/sign/sign.go +++ b/topdown/internal/jwx/jws/sign/sign.go @@ -1,8 +1,9 @@ package sign import ( - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) // New creates a signer that signs payloads using the given signature algorithm. diff --git a/topdown/internal/jwx/jws/verify/ecdsa.go b/topdown/internal/jwx/jws/verify/ecdsa.go index 5c89aed90a..5adccda30e 100644 --- a/topdown/internal/jwx/jws/verify/ecdsa.go +++ b/topdown/internal/jwx/jws/verify/ecdsa.go @@ -5,8 +5,9 @@ import ( "crypto/ecdsa" "math/big" - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) var ecdsaVerifyFuncs = map[jwa.SignatureAlgorithm]ecdsaVerifyFunc{} diff --git a/topdown/internal/jwx/jws/verify/ecdsa_test.go b/topdown/internal/jwx/jws/verify/ecdsa_test.go index 2072f55d9c..73a04e4ff5 100644 --- a/topdown/internal/jwx/jws/verify/ecdsa_test.go +++ b/topdown/internal/jwx/jws/verify/ecdsa_test.go @@ -1,8 +1,9 @@ package verify import ( - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "testing" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) func TestECDSAVerify(t *testing.T) { diff --git a/topdown/internal/jwx/jws/verify/hmac.go b/topdown/internal/jwx/jws/verify/hmac.go index 47eb28ecc9..e0b5e1981c 100644 --- a/topdown/internal/jwx/jws/verify/hmac.go +++ b/topdown/internal/jwx/jws/verify/hmac.go @@ -2,9 +2,11 @@ package verify import ( "crypto/hmac" + + "github.com/pkg/errors" + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/open-policy-agent/opa/topdown/internal/jwx/jws/sign" - "github.com/pkg/errors" ) func newHMAC(alg jwa.SignatureAlgorithm) (*HMACVerifier, error) { diff --git a/topdown/internal/jwx/jws/verify/hmac_test.go b/topdown/internal/jwx/jws/verify/hmac_test.go index a52a4624b0..bc3ca7aa09 100644 --- a/topdown/internal/jwx/jws/verify/hmac_test.go +++ b/topdown/internal/jwx/jws/verify/hmac_test.go @@ -1,8 +1,9 @@ package verify import ( - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "testing" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) func TestHMACVerify(t *testing.T) { diff --git a/topdown/internal/jwx/jws/verify/interface.go b/topdown/internal/jwx/jws/verify/interface.go index 56724c3fa3..b72b7232ad 100644 --- a/topdown/internal/jwx/jws/verify/interface.go +++ b/topdown/internal/jwx/jws/verify/interface.go @@ -3,6 +3,7 @@ package verify import ( "crypto/ecdsa" "crypto/rsa" + "github.com/open-policy-agent/opa/topdown/internal/jwx/jws/sign" ) diff --git a/topdown/internal/jwx/jws/verify/rsa.go b/topdown/internal/jwx/jws/verify/rsa.go index de813681cc..26f341d129 100644 --- a/topdown/internal/jwx/jws/verify/rsa.go +++ b/topdown/internal/jwx/jws/verify/rsa.go @@ -3,6 +3,7 @@ package verify import ( "crypto" "crypto/rsa" + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" diff --git a/topdown/internal/jwx/jws/verify/rsa_test.go b/topdown/internal/jwx/jws/verify/rsa_test.go index 90322913fa..7a1b0659d3 100644 --- a/topdown/internal/jwx/jws/verify/rsa_test.go +++ b/topdown/internal/jwx/jws/verify/rsa_test.go @@ -1,8 +1,9 @@ package verify import ( - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "testing" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) func TestRSAVerify(t *testing.T) { diff --git a/topdown/internal/jwx/jws/verify/verify.go b/topdown/internal/jwx/jws/verify/verify.go index 8ad426bd6f..d484cda0b5 100644 --- a/topdown/internal/jwx/jws/verify/verify.go +++ b/topdown/internal/jwx/jws/verify/verify.go @@ -1,8 +1,9 @@ package verify import ( - "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" "github.com/pkg/errors" + + "github.com/open-policy-agent/opa/topdown/internal/jwx/jwa" ) // New creates a new JWS verifier using the specified algorithm diff --git a/util/hashmap.go b/util/hashmap.go index 3ba40208fb..11e7dca40b 100644 --- a/util/hashmap.go +++ b/util/hashmap.go @@ -4,8 +4,10 @@ package util -import "fmt" -import "strings" +import ( + "fmt" + "strings" +) // T is a concise way to refer to T. type T interface{}