Skip to content

Commit

Permalink
fix: use contains to check for match (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Muchogoc committed Feb 21, 2023
1 parent 2bcca48 commit ac5b621
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 25 deletions.
28 changes: 7 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
lint_and_test:
strategy:
matrix:
go-version: [1.16.x]
go-version: [1.18.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 80
Expand All @@ -43,33 +43,18 @@ jobs:
- name: Install Go dependencies
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.37.1
go get -u github.com/kisielk/errcheck
go get -u golang.org/x/lint/golint
go install honnef.co/go/tools/cmd/staticcheck@2021.1.2
go get -u github.com/axw/gocov/gocov
go get -u github.com/securego/gosec/cmd/gosec
go get -u github.com/ory/go-acc
go get golang.org/x/oauth2/internal
go get google.golang.org/grpc
go get google.golang.org/grpc/internal/transport
go get -u github.com/client9/misspell/cmd/misspell
go get -u github.com/gordonklaus/ineffassign
go get github.com/fzipp/gocyclo
go get github.com/stretchr/testify/assert@v1.7.0
go get github.com/ory/go-acc
go get contrib.go.opencensus.io/exporter/stackdriver@v0.13.6
go get cloud.google.com/go/errorreporting
go get cloud.google.com/go/profiler
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.13.1
go install honnef.co/go/tools/cmd/staticcheck@2022.1
go install github.com/ory/go-acc@latest
go install github.com/axw/gocov/gocov@latest
go install github.com/kisielk/errcheck@latest
- name: Run lint and test
run: |
staticcheck ./...
go fmt $(go list ./... | grep -v /vendor/)
go vet $(go list ./... | grep -v /vendor/)
golint -set_exit_status $(go list ./... | grep -v /vendor/)
errcheck -ignore 'os:.*,' $(go list ./... | grep -v /vendor/)
misspell -error .
gosec -exclude=G304,G101 ./...
go-acc -o coverage.txt --ignore generated,cmd ./... -- -timeout 60m
grep -v "generated.go" coverage.txt > coverage.out
Expand All @@ -82,6 +67,7 @@ jobs:
env:
GO111MODULE: off
run: go get github.com/mattn/goveralls

- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
37 changes: 35 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/savannahghi/serverutils

go 1.16
go 1.18

require (
cloud.google.com/go v0.84.0
Expand All @@ -11,12 +11,45 @@ require (
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/objx v0.3.0 // indirect
github.com/stretchr/testify v1.7.0
github.com/vektah/gqlparser/v2 v2.1.0
go.opencensus.io v0.23.0
go.opentelemetry.io/otel v1.0.0-RC1
go.opentelemetry.io/otel/exporters/jaeger v1.0.0-RC1
go.opentelemetry.io/otel/sdk v1.0.0-RC1
)

require (
github.com/agnivade/levenshtein v1.0.3 // indirect
github.com/aws/aws-sdk-go v1.37.0 // indirect
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.3.0 // indirect
go.opentelemetry.io/otel/trace v1.0.0-RC1 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 // indirect
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/tools v0.1.2 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/api v0.48.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d // indirect
google.golang.org/grpc v1.38.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
5 changes: 3 additions & 2 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"log"
"os"
"path/filepath"
"strings"

"github.com/99designs/gqlgen/plugin"

Expand Down Expand Up @@ -68,7 +69,7 @@ func (m *ImportPlugin) InjectSourceEarly() *ast.Source {
for _, source := range m.earlySources {
// federation directives and entities are already provided using the federation plugin
// They should be skipped to avoid conflict with/from the federation plugin
if source.Name == "federation/directives.graphql" || source.Name == "federation/entity.graphql" {
if strings.Contains(source.Name, "federation/directives.graphql") || strings.Contains(source.Name, "federation/entity.graphql") {
continue
}
// Contents of the source file
Expand Down Expand Up @@ -100,7 +101,7 @@ func (m *ImportPlugin) InjectSourceLate(schema *ast.Schema) *ast.Source {
for _, source := range m.earlySources {
// federation directives and entities are already provided using the federation plugin
// They should be skipped to avoid conflict with the federation one
if source.Name == "federation/directives.graphql" || source.Name == "federation/entity.graphql" {
if strings.Contains(source.Name, "federation/directives.graphql") || strings.Contains(source.Name, "federation/entity.graphql") {
continue
}
// Contents of the source file
Expand Down

0 comments on commit ac5b621

Please sign in to comment.