diff --git a/apps/disco/main.go b/apps/disco/main.go index 62fb172f..ec5a067e 100644 --- a/apps/disco/main.go +++ b/apps/disco/main.go @@ -23,6 +23,7 @@ import ( "github.com/docopt/docopt-go" "github.com/golang/protobuf/proto" + "github.com/google/gnostic/conversions" discovery "github.com/google/gnostic/discovery" ) diff --git a/apps/petstore-builder/petstore-v2.go b/apps/petstore-builder/petstore-v2.go index 4fc977b6..ec2cd6e2 100644 --- a/apps/petstore-builder/petstore-v2.go +++ b/apps/petstore-builder/petstore-v2.go @@ -252,7 +252,7 @@ func buildDocumentV2() *v2.Document { &v2.NamedSchema{Name: "code", Value: &v2.Schema{ Type: &v2.TypeItem{Value: []string{"integer"}}, Format: "int32"}}, - &v2.NamedSchema{Name: "message", Value: &v2.Schema{Type: &v2.TypeItem{Value:[]string{"string"}}}}, + &v2.NamedSchema{Name: "message", Value: &v2.Schema{Type: &v2.TypeItem{Value: []string{"string"}}}}, }, }, }}) diff --git a/apps/protoc-gen-openapi/generator/openapi-v3.go b/apps/protoc-gen-openapi/generator/openapi-v3.go index 5a81ae63..c486f1b3 100644 --- a/apps/protoc-gen-openapi/generator/openapi-v3.go +++ b/apps/protoc-gen-openapi/generator/openapi-v3.go @@ -22,11 +22,12 @@ import ( "sort" "strings" - v3 "github.com/google/gnostic/openapiv3" "google.golang.org/genproto/googleapis/api/annotations" "google.golang.org/protobuf/compiler/protogen" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" + + v3 "github.com/google/gnostic/openapiv3" ) const infoURL = "https://github.com/googleapis/gnostic/tree/master/apps/protoc-gen-openapi" diff --git a/apps/protoc-gen-openapi/main.go b/apps/protoc-gen-openapi/main.go index 3d16d423..af621d65 100644 --- a/apps/protoc-gen-openapi/main.go +++ b/apps/protoc-gen-openapi/main.go @@ -16,8 +16,9 @@ package main import ( - "github.com/google/gnostic/apps/protoc-gen-openapi/generator" "google.golang.org/protobuf/compiler/protogen" + + "github.com/google/gnostic/apps/protoc-gen-openapi/generator" ) func main() { diff --git a/apps/report-messages/main.go b/apps/report-messages/main.go index 84388b3a..a308a80f 100644 --- a/apps/report-messages/main.go +++ b/apps/report-messages/main.go @@ -22,6 +22,7 @@ import ( "os" "github.com/golang/protobuf/proto" + "github.com/google/gnostic/printer" plugins "github.com/google/gnostic/plugins" @@ -43,13 +44,13 @@ func readMessagesFromFileWithName(filename string) *plugins.Messages { func printMessages(code *printer.Code, messages *plugins.Messages) { for _, message := range messages.Messages { - line := fmt.Sprintf("%-7s %-14s %s %+v", - message.Level, - message.Code, - message.Text, - message.Keys) + line := fmt.Sprintf("%-7s %-14s %s %+v", + message.Level, + message.Code, + message.Text, + message.Keys) code.Print(line) - } + } } func main() { diff --git a/apps/report/main.go b/apps/report/main.go index dce382ee..f0b166b3 100644 --- a/apps/report/main.go +++ b/apps/report/main.go @@ -24,6 +24,7 @@ import ( "os" "github.com/golang/protobuf/proto" + "github.com/google/gnostic/printer" pb "github.com/google/gnostic/openapiv2" diff --git a/apps/vocabulary-operations/main.go b/apps/vocabulary-operations/main.go index 5a071489..8bc22ef2 100644 --- a/apps/vocabulary-operations/main.go +++ b/apps/vocabulary-operations/main.go @@ -23,6 +23,7 @@ import ( "strings" "github.com/golang/protobuf/proto" + metrics "github.com/google/gnostic/metrics" vocabulary "github.com/google/gnostic/metrics/vocabulary" ) diff --git a/compiler/extensions.go b/compiler/extensions.go index 962cb968..5b5a916d 100644 --- a/compiler/extensions.go +++ b/compiler/extensions.go @@ -22,8 +22,9 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/any" - extensions "github.com/google/gnostic/extensions" yaml "gopkg.in/yaml.v3" + + extensions "github.com/google/gnostic/extensions" ) // ExtensionHandler describes a binary that is called by the compiler to handle specification extensions. diff --git a/compiler/helpers.go b/compiler/helpers.go index 3dff9e36..97ffaa51 100644 --- a/compiler/helpers.go +++ b/compiler/helpers.go @@ -20,8 +20,9 @@ import ( "sort" "strconv" - "github.com/google/gnostic/jsonschema" "gopkg.in/yaml.v3" + + "github.com/google/gnostic/jsonschema" ) // compiler helper functions, usually called from generated code diff --git a/conversions/openapiv2.go b/conversions/openapiv2.go index 71a41978..fb738865 100644 --- a/conversions/openapiv2.go +++ b/conversions/openapiv2.go @@ -18,8 +18,8 @@ import ( "log" "net/url" - openapi2 "github.com/google/gnostic/openapiv2" discovery "github.com/google/gnostic/discovery" + openapi2 "github.com/google/gnostic/openapiv2" ) func addOpenAPI2SchemaForSchema(d *openapi2.Document, name string, schema *discovery.Schema) { diff --git a/conversions/openapiv3.go b/conversions/openapiv3.go index b710fabb..576c2ec2 100644 --- a/conversions/openapiv3.go +++ b/conversions/openapiv3.go @@ -19,8 +19,8 @@ import ( "net/url" "strings" - openapi3 "github.com/google/gnostic/openapiv3" discovery "github.com/google/gnostic/discovery" + openapi3 "github.com/google/gnostic/openapiv3" ) func pathForMethod(path string) string { diff --git a/discovery/discovery.go b/discovery/discovery.go index 07543230..c13c2320 100644 --- a/discovery/discovery.go +++ b/discovery/discovery.go @@ -18,10 +18,12 @@ package discovery_v1 import ( "fmt" - "github.com/google/gnostic/compiler" - "gopkg.in/yaml.v3" "regexp" "strings" + + "gopkg.in/yaml.v3" + + "github.com/google/gnostic/compiler" ) // Version returns the package name (and OpenAPI version). diff --git a/lib/gnostic.go b/lib/gnostic.go index c33cb444..dc7cd843 100644 --- a/lib/gnostic.go +++ b/lib/gnostic.go @@ -29,6 +29,8 @@ import ( "time" "github.com/golang/protobuf/proto" + "gopkg.in/yaml.v3" + "github.com/google/gnostic/compiler" discovery_v1 "github.com/google/gnostic/discovery" "github.com/google/gnostic/jsonwriter" @@ -36,7 +38,6 @@ import ( openapi_v3 "github.com/google/gnostic/openapiv3" plugins "github.com/google/gnostic/plugins" surface "github.com/google/gnostic/surface" - "gopkg.in/yaml.v3" ) // UsageError is a response to invalid command-line inputs diff --git a/linters/go/gnostic-lint-descriptions/linter_v3.go b/linters/go/gnostic-lint-descriptions/linter_v3.go index 6f8684c6..b30ba8c0 100644 --- a/linters/go/gnostic-lint-descriptions/linter_v3.go +++ b/linters/go/gnostic-lint-descriptions/linter_v3.go @@ -16,7 +16,7 @@ package main import ( openapi "github.com/google/gnostic/openapiv3" - plugins "github.com/google/gnostic/plugins" + plugins "github.com/google/gnostic/plugins" ) // DocumentLinter contains information collected about an API description. diff --git a/linters/go/gnostic-lint-descriptions/main.go b/linters/go/gnostic-lint-descriptions/main.go index 3b8a7daf..ea33ce62 100644 --- a/linters/go/gnostic-lint-descriptions/main.go +++ b/linters/go/gnostic-lint-descriptions/main.go @@ -22,6 +22,7 @@ package main import ( "github.com/golang/protobuf/proto" + openapiv2 "github.com/google/gnostic/openapiv2" openapiv3 "github.com/google/gnostic/openapiv3" plugins "github.com/google/gnostic/plugins" diff --git a/linters/go/gnostic-lint-paths/main.go b/linters/go/gnostic-lint-paths/main.go index 73330ee5..56dab5bd 100644 --- a/linters/go/gnostic-lint-paths/main.go +++ b/linters/go/gnostic-lint-paths/main.go @@ -19,6 +19,7 @@ package main import ( "github.com/golang/protobuf/proto" + openapiv2 "github.com/google/gnostic/openapiv2" openapiv3 "github.com/google/gnostic/openapiv3" plugins "github.com/google/gnostic/plugins" diff --git a/metrics/vocabulary/vocabulary.go b/metrics/vocabulary/vocabulary.go index 1ef1faea..cbca53f9 100644 --- a/metrics/vocabulary/vocabulary.go +++ b/metrics/vocabulary/vocabulary.go @@ -24,8 +24,9 @@ import ( "sort" "strings" - metrics "github.com/google/gnostic/metrics" "google.golang.org/protobuf/proto" + + metrics "github.com/google/gnostic/metrics" ) type Vocabulary struct { diff --git a/metrics/vocabulary/vocabulary_test.go b/metrics/vocabulary/vocabulary_test.go index edf1f37f..90d93868 100644 --- a/metrics/vocabulary/vocabulary_test.go +++ b/metrics/vocabulary/vocabulary_test.go @@ -21,6 +21,7 @@ import ( "testing" "github.com/golang/protobuf/jsonpb" + discovery "github.com/google/gnostic/discovery" metrics "github.com/google/gnostic/metrics" openapiv2 "github.com/google/gnostic/openapiv2" diff --git a/openapiv2/OpenAPIv2.go b/openapiv2/OpenAPIv2.go index 0a595f9f..0f179076 100644 --- a/openapiv2/OpenAPIv2.go +++ b/openapiv2/OpenAPIv2.go @@ -18,10 +18,12 @@ package openapi_v2 import ( "fmt" - "github.com/google/gnostic/compiler" - "gopkg.in/yaml.v3" "regexp" "strings" + + "gopkg.in/yaml.v3" + + "github.com/google/gnostic/compiler" ) // Version returns the package name (and OpenAPI version). diff --git a/openapiv2/document.go b/openapiv2/document.go index c22f03fa..0021ae87 100644 --- a/openapiv2/document.go +++ b/openapiv2/document.go @@ -15,8 +15,9 @@ package openapi_v2 import ( - "github.com/google/gnostic/compiler" "gopkg.in/yaml.v3" + + "github.com/google/gnostic/compiler" ) // ParseDocument reads an OpenAPI v2 description from a YAML/JSON representation. diff --git a/openapiv3/OpenAPIv3.go b/openapiv3/OpenAPIv3.go index 58d63571..dc6feb3d 100644 --- a/openapiv3/OpenAPIv3.go +++ b/openapiv3/OpenAPIv3.go @@ -18,10 +18,12 @@ package openapi_v3 import ( "fmt" - "github.com/google/gnostic/compiler" - "gopkg.in/yaml.v3" "regexp" "strings" + + "gopkg.in/yaml.v3" + + "github.com/google/gnostic/compiler" ) // Version returns the package name (and OpenAPI version). diff --git a/openapiv3/document.go b/openapiv3/document.go index f64e52be..ef10d1d9 100644 --- a/openapiv3/document.go +++ b/openapiv3/document.go @@ -15,8 +15,9 @@ package openapi_v3 import ( - "github.com/google/gnostic/compiler" "gopkg.in/yaml.v3" + + "github.com/google/gnostic/compiler" ) // ParseDocument reads an OpenAPI v3 description from a YAML/JSON representation. diff --git a/plugins/environment.go b/plugins/environment.go index 0a856aa4..3a935295 100644 --- a/plugins/environment.go +++ b/plugins/environment.go @@ -14,9 +14,9 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes/any" + discovery "github.com/google/gnostic/discovery" openapiv2 "github.com/google/gnostic/openapiv2" openapiv3 "github.com/google/gnostic/openapiv3" - discovery "github.com/google/gnostic/discovery" surface "github.com/google/gnostic/surface" ) diff --git a/plugins/gnostic-analyze/main.go b/plugins/gnostic-analyze/main.go index fd4cc174..f2e6918f 100644 --- a/plugins/gnostic-analyze/main.go +++ b/plugins/gnostic-analyze/main.go @@ -33,6 +33,7 @@ import ( "github.com/google/gnostic/plugins/gnostic-analyze/statistics" "github.com/golang/protobuf/proto" + openapiv2 "github.com/google/gnostic/openapiv2" openapiv3 "github.com/google/gnostic/openapiv3" plugins "github.com/google/gnostic/plugins" diff --git a/plugins/gnostic-complexity/main.go b/plugins/gnostic-complexity/main.go index 1e8543b9..fbffc45c 100644 --- a/plugins/gnostic-complexity/main.go +++ b/plugins/gnostic-complexity/main.go @@ -20,6 +20,7 @@ import ( "path/filepath" "github.com/golang/protobuf/proto" + metrics "github.com/google/gnostic/metrics" openapiv2 "github.com/google/gnostic/openapiv2" openapiv3 "github.com/google/gnostic/openapiv3" diff --git a/plugins/gnostic-linter/main.go b/plugins/gnostic-linter/main.go index 826d5508..116f80b6 100644 --- a/plugins/gnostic-linter/main.go +++ b/plugins/gnostic-linter/main.go @@ -19,6 +19,7 @@ import ( "path/filepath" "github.com/golang/protobuf/proto" + lint "github.com/google/gnostic/metrics/lint" openapiv2 "github.com/google/gnostic/openapiv2" openapiv3 "github.com/google/gnostic/openapiv3" diff --git a/plugins/gnostic-plugin-request/main.go b/plugins/gnostic-plugin-request/main.go index dd131193..0c42af60 100644 --- a/plugins/gnostic-plugin-request/main.go +++ b/plugins/gnostic-plugin-request/main.go @@ -21,6 +21,7 @@ import ( "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + openapiv2 "github.com/google/gnostic/openapiv2" openapiv3 "github.com/google/gnostic/openapiv3" plugins "github.com/google/gnostic/plugins" diff --git a/plugins/gnostic-process-plugin-response/main.go b/plugins/gnostic-process-plugin-response/main.go index cfaee0a1..294b97b0 100644 --- a/plugins/gnostic-process-plugin-response/main.go +++ b/plugins/gnostic-process-plugin-response/main.go @@ -24,6 +24,7 @@ import ( "os" "github.com/golang/protobuf/proto" + plugins "github.com/google/gnostic/plugins" ) diff --git a/plugins/gnostic-summary/main.go b/plugins/gnostic-summary/main.go index d25a27e9..846e2904 100644 --- a/plugins/gnostic-summary/main.go +++ b/plugins/gnostic-summary/main.go @@ -21,6 +21,7 @@ import ( "path/filepath" "github.com/golang/protobuf/proto" + openapiv2 "github.com/google/gnostic/openapiv2" openapiv3 "github.com/google/gnostic/openapiv3" plugins "github.com/google/gnostic/plugins" diff --git a/plugins/gnostic-vocabulary/main.go b/plugins/gnostic-vocabulary/main.go index b67c666a..dbfb1125 100644 --- a/plugins/gnostic-vocabulary/main.go +++ b/plugins/gnostic-vocabulary/main.go @@ -20,6 +20,7 @@ import ( "path/filepath" "github.com/golang/protobuf/proto" + discovery_v1 "github.com/google/gnostic/discovery" metrics "github.com/google/gnostic/metrics" vocabulary "github.com/google/gnostic/metrics/vocabulary" diff --git a/surface/model_openapiv2.go b/surface/model_openapiv2.go index 547d1b18..9974f028 100644 --- a/surface/model_openapiv2.go +++ b/surface/model_openapiv2.go @@ -15,10 +15,11 @@ package surface_v1 import ( - openapiv2 "github.com/google/gnostic/openapiv2" - "github.com/google/gnostic/compiler" "log" "strconv" + + "github.com/google/gnostic/compiler" + openapiv2 "github.com/google/gnostic/openapiv2" ) type OpenAPI2Builder struct { diff --git a/surface/model_openapiv3.go b/surface/model_openapiv3.go index 1e8b0dfa..83df4ed9 100644 --- a/surface/model_openapiv3.go +++ b/surface/model_openapiv3.go @@ -15,10 +15,11 @@ package surface_v1 import ( - "github.com/google/gnostic/compiler" - openapiv3 "github.com/google/gnostic/openapiv3" "log" "strings" + + "github.com/google/gnostic/compiler" + openapiv3 "github.com/google/gnostic/openapiv3" ) type OpenAPI3Builder struct { diff --git a/tools/format-schema/main.go b/tools/format-schema/main.go index 9c8245be..5cc363c3 100644 --- a/tools/format-schema/main.go +++ b/tools/format-schema/main.go @@ -17,9 +17,10 @@ package main import ( "fmt" - "github.com/google/gnostic/jsonschema" "os" "path" + + "github.com/google/gnostic/jsonschema" ) func main() { diff --git a/tools/j2y2j/main.go b/tools/j2y2j/main.go index b4060978..4b74fb43 100644 --- a/tools/j2y2j/main.go +++ b/tools/j2y2j/main.go @@ -21,8 +21,9 @@ import ( "os" "path" - "github.com/google/gnostic/jsonschema" "gopkg.in/yaml.v3" + + "github.com/google/gnostic/jsonschema" ) func usage() {