Skip to content

Commit

Permalink
.github: use gofumports
Browse files Browse the repository at this point in the history
Signed-off-by: Jimmy Zelinskie <[email protected]>
  • Loading branch information
jzelinskie committed Jul 6, 2021
1 parent 53d8bea commit 80c4834
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 32 deletions.
27 changes: 8 additions & 19 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,19 @@ jobs:
- uses: "actions/setup-go@v2"
with:
go-version: ^1.16
- name: "go fmt"
- name: "go imports"
run: |
GOFMT_OUTPUT="$(gofmt -l `find ./ -name '*.go' | grep -v vendor` 2>&1)"
if [ -n "$GOFMT_OUTPUT" ]; then
go install mvdan.cc/gofumpt/gofumports@latest
GOFUMPT_OUTPUT="$(gofumports -d `find ./ -name '*.go' | grep -v proto/`)"
if [ -n "$GOFUMPT_OUTPUT" ]; then
echo "All the following files are not correctly formatted"
echo "${GOFMT_OUTPUT}"
echo "${GOFUMPT_OUTPUT}"
exit 1
fi
- name: "go imports"
- name: "go lint"
run: |
exec 5>&1
GOIMPORTS_OUTPUT="$(goimports -l -w `find ./ -name '*.go' | grep -v vendor` | tee /dev/fd/5)"
if [ -n "$GOIMPORTS_OUTPUT" ]; then
echo "All following has imports not properly ordered"
echo "${GOIMPORTS_OUTPUT}"
exit 1
fi
go install github.com/mgechev/revive@latest
revive ./...
- name: "go mod tidy"
run: |
GO_MOD_OUPUT="$(go mod tidy -v 2>&1)"
Expand All @@ -44,10 +37,6 @@ jobs:
echo "${GO_MOD_OUPUT}"
exit 1
fi
- name: "go lint"
run: |
go install github.com/mgechev/revive@latest
revive ./...
test:
name: "Test"
Expand Down
3 changes: 2 additions & 1 deletion v0/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ func SystemCerts(v CertVerification) grpc.DialOption {

return grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{
RootCAs: certPool,
InsecureSkipVerify: bool(v)}))
InsecureSkipVerify: bool(v),
}))
}

// NewClient initializes a brand new client for interacting with Authzed.
Expand Down
3 changes: 2 additions & 1 deletion v0/examples/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func main() {
createTuple(tuple(aDoc("owner"), anOwner)),
createTuple(tuple(aDoc("contributor"), anEditor)),
createTuple(tuple(aDoc("viewer"), aViewer)),
}})
},
})
if err != nil {
log.Fatalf("unable to write tuples: %s", err)
}
Expand Down
16 changes: 7 additions & 9 deletions v0/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ var (
)
)

var (
fred = &v0.User{UserOneof: &v0.User_Userset{
Userset: &v0.ObjectAndRelation{
Namespace: "test/user",
ObjectId: "fred",
Relation: "...",
},
}}
)
var fred = &v0.User{UserOneof: &v0.User_Userset{
Userset: &v0.ObjectAndRelation{
Namespace: "test/user",
ObjectId: "fred",
Relation: "...",
},
}}

func setupTenant(t *testing.T) *Client {
client, err := NewClient("localhost:50051", grpc.WithInsecure())
Expand Down
5 changes: 3 additions & 2 deletions v1alpha1/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"log"
"testing"

"github.com/authzed/authzed-go/v1alpha1"
"github.com/authzed/grpcutil"

authzed "github.com/authzed/authzed-go/v1alpha1"
)

func ExampleNewClient(t *testing.T) {
func ExampleNewClient(_ *testing.T) {
client, err := authzed.NewClient(
"grpc.authzed.com:443",
grpcutil.WithBearerToken("tc_my_token_deadbeefdeadbeefdeadbeef"),
Expand Down

0 comments on commit 80c4834

Please sign in to comment.