Skip to content
Merged
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
15 changes: 7 additions & 8 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ on: [ pull_request ]

jobs:
compliant:
runs-on: [ self-hosted, X64 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Check License Header
uses: apache/skywalking-eyes/header@v0.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: typos-action
- name: Check Spell
uses: crate-ci/typos@master
Comment thread
GuangmingLuo marked this conversation as resolved.

resolve-modules:
Expand All @@ -23,7 +23,7 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set execute permission for resolve-modules.sh
run: chmod +x ./hack/resolve-modules.sh
Expand All @@ -38,11 +38,10 @@ jobs:
strategy:
matrix: ${{ fromJson(needs.resolve-modules.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v8
with:
version: latest
Comment thread
GuangmingLuo marked this conversation as resolved.
working-directory: ${{ matrix.workdir }}
args: -E gofumpt --timeout 10m
skip-pkg-cache: true
args: --timeout 5m
44 changes: 12 additions & 32 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,16 @@
# Options for analysis running.
run:
# include `vendor` `third_party` `testdata` `examples` `Godeps` `builtin`
skip-dirs-use-default: true
# output configuration options
output:
# Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
formats: colored-line-number
# All available settings of specific linters.
# Refer to https://golangci-lint.run/usage/linters
linters-settings:
gofumpt:
# Choose whether to use the extra rules.
# Default: false
extra-rules: true
govet:
# Disable analyzers by name.
# Run `go tool vet help` to see all analyzers.
disable:
- stdmethods
version: "2"
linters:
default: none
enable:
- govet
- ineffassign
- staticcheck
- unconvert
- unused
Comment thread
GuangmingLuo marked this conversation as resolved.
formatters:
enable:
- gofumpt
- goimports
- gofmt
disable:
- errcheck
- typecheck
- varcheck
- staticcheck
issues:
exclude-use-default: true
exclude-files:
- ".*\\.mock\\.go$"
exclude-dirs:
- kitex_gen
settings:
gofumpt:
extra-rules: true
Comment thread
GuangmingLuo marked this conversation as resolved.
8 changes: 5 additions & 3 deletions protoc-gen-http-swagger/generator/reflector.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ func (r *OpenAPIReflector) formatMessageName(message protoreflect.MessageDescrip

name := r.getMessageName(message)
if !*r.conf.FQSchemaNaming {
if typeName == ".google.protobuf.Value" {
switch typeName {
case ".google.protobuf.Value":
name = consts.ProtobufValueName
} else if typeName == ".google.protobuf.Any" {
case ".google.protobuf.Any":
name = consts.ProtobufAnyName
default:
}
}

Expand Down Expand Up @@ -216,7 +218,7 @@ func (r *OpenAPIReflector) schemaOrReferenceForField(field protoreflect.FieldDes
kindSchema = wk.NewStringSchema()

case protoreflect.EnumKind:
kindSchema = wk.NewEnumSchema(*&r.conf.EnumType, field)
kindSchema = wk.NewEnumSchema(r.conf.EnumType, field)

case protoreflect.BoolKind:
kindSchema = wk.NewBooleanSchema()
Expand Down
8 changes: 5 additions & 3 deletions protoc-gen-rpc-swagger/generator/reflector.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ func (r *OpenAPIReflector) formatMessageName(message protoreflect.MessageDescrip

name := r.getMessageName(message)
if !*r.conf.FQSchemaNaming {
if typeName == ".google.protobuf.Value" {
switch typeName {
case ".google.protobuf.Value":
name = consts.ProtobufValueName
} else if typeName == ".google.protobuf.Any" {
case ".google.protobuf.Any":
name = consts.ProtobufAnyName
default:
}
}

Expand Down Expand Up @@ -216,7 +218,7 @@ func (r *OpenAPIReflector) schemaOrReferenceForField(field protoreflect.FieldDes
kindSchema = wk.NewStringSchema()

case protoreflect.EnumKind:
kindSchema = wk.NewEnumSchema(*&r.conf.EnumType, field)
kindSchema = wk.NewEnumSchema(r.conf.EnumType, field)

case protoreflect.BoolKind:
kindSchema = wk.NewBooleanSchema()
Expand Down
12 changes: 6 additions & 6 deletions thrift-gen-http-swagger/generator/openapi_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,19 @@ func (g *OpenAPIGenerator) getDocumentOption(obj interface{}) error {
return nil
}

if serviceOrStruct == consts.DocumentOptionServiceType {
switch serviceOrStruct {
case consts.DocumentOptionServiceType:
serviceDesc := g.fileDesc.GetServiceDescriptor(name)
if serviceDesc != nil {
err := utils.ParseServiceOption(serviceDesc, consts.OpenapiDocument, obj)
if err != nil {
if err := utils.ParseServiceOption(serviceDesc, consts.OpenapiDocument, obj); err != nil {
return err
}
}
} else if serviceOrStruct == consts.DocumentOptionStructType {

case consts.DocumentOptionStructType:
structDesc := g.fileDesc.GetStructDescriptor(name)
if structDesc != nil {
err := utils.ParseStructOption(structDesc, consts.OpenapiDocument, obj)
if err != nil {
if err := utils.ParseStructOption(structDesc, consts.OpenapiDocument, obj); err != nil {
return err
}
}
Expand Down
Loading