Skip to content

Commit

Permalink
all: run goimports
Browse files Browse the repository at this point in the history
$ goimports -w -local github.com/google/gnostic $(find . -type f -name '*.go' -not -iwholename '*vendor*' -not -name '*.pb.go')

Signed-off-by: Koichi Shiraishi <[email protected]>
  • Loading branch information
zchee committed Sep 26, 2021
1 parent 05ffbf4 commit 7a88755
Show file tree
Hide file tree
Showing 34 changed files with 63 additions and 31 deletions.
1 change: 1 addition & 0 deletions apps/disco/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion apps/petstore-builder/petstore-v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}}},
},
},
}})
Expand Down
3 changes: 2 additions & 1 deletion apps/protoc-gen-openapi/generator/openapi-v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion apps/protoc-gen-openapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
13 changes: 7 additions & 6 deletions apps/report-messages/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"os"

"github.com/golang/protobuf/proto"

"github.com/google/gnostic/printer"

plugins "github.com/google/gnostic/plugins"
Expand All @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions apps/report/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"os"

"github.com/golang/protobuf/proto"

"github.com/google/gnostic/printer"

pb "github.com/google/gnostic/openapiv2"
Expand Down
1 change: 1 addition & 0 deletions apps/vocabulary-operations/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"strings"

"github.com/golang/protobuf/proto"

metrics "github.com/google/gnostic/metrics"
vocabulary "github.com/google/gnostic/metrics/vocabulary"
)
Expand Down
3 changes: 2 additions & 1 deletion compiler/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion compiler/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion conversions/openapiv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion conversions/openapiv3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
3 changes: 2 additions & 1 deletion lib/gnostic.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ 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"
openapi_v2 "github.com/google/gnostic/openapiv2"
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
Expand Down
2 changes: 1 addition & 1 deletion linters/go/gnostic-lint-descriptions/linter_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions linters/go/gnostic-lint-descriptions/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions linters/go/gnostic-lint-paths/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion metrics/vocabulary/vocabulary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions metrics/vocabulary/vocabulary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions openapiv2/OpenAPIv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
3 changes: 2 additions & 1 deletion openapiv2/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions openapiv3/OpenAPIv3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
3 changes: 2 additions & 1 deletion openapiv3/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion plugins/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
1 change: 1 addition & 0 deletions plugins/gnostic-analyze/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions plugins/gnostic-complexity/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions plugins/gnostic-linter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions plugins/gnostic-plugin-request/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions plugins/gnostic-process-plugin-response/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"os"

"github.com/golang/protobuf/proto"

plugins "github.com/google/gnostic/plugins"
)

Expand Down
1 change: 1 addition & 0 deletions plugins/gnostic-summary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions plugins/gnostic-vocabulary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions surface/model_openapiv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions surface/model_openapiv3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion tools/format-schema/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ package main

import (
"fmt"
"github.com/google/gnostic/jsonschema"
"os"
"path"

"github.com/google/gnostic/jsonschema"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion tools/j2y2j/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (
"os"
"path"

"github.com/google/gnostic/jsonschema"
"gopkg.in/yaml.v3"

"github.com/google/gnostic/jsonschema"
)

func usage() {
Expand Down

0 comments on commit 7a88755

Please sign in to comment.