cloudspannerecosystem / spanner-cli

Interactive command line tool for Cloud Spanner
Apache License 2.0
228 stars 29 forks source link

Support accessing database with fine-grained access control #147

Closed toga4 closed 1 year ago

toga4 commented 1 year ago

This PR adds support accessing database with fine-grained access control.

CLI Option:

spanner-cli -p <project> -i <instance> -d <database> --role <role>

Syntax:

USE <database> ROLE <role>;

https://cloud.google.com/spanner/docs/access-with-fgac?hl=en

Resolves #146

toga4 commented 1 year ago

CI seems failed. I'll check it.

yfuruyama commented 1 year ago

It seems that io/fs package was released in Go 1.16 (release notes), but we still use very old version, Go 1.14 in GitHub Actions. https://github.com/cloudspannerecosystem/spanner-cli/blob/6703476b4f7b8652685d922b905033d1b56ce69a/.github/workflows/run-tests.yaml#L36

Could you update run-tests.yaml file to use Go 1.16? 🙏

toga4 commented 1 year ago

Thanks. I'll do it. Do I need to upgrade Go version in go.mod?

yfuruyama commented 1 year ago

Do I need to upgrade Go version in go.mod?

Thanks! Let's update go.mod as well 🙏

toga4 commented 1 year ago

Done. Now CI should be a success!

yfuruyama commented 1 year ago

Thanks!

# golang.org/x/sys/unix
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.6.0/unix/syscall.go:83:16: undefined: unsafe.Slice
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.6.0/unix/syscall_linux.go:1018:20: undefined: unsafe.Slice
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.6.0/unix/syscall_linux.go:2289:9: undefined: unsafe.Slice
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.6.0/unix/syscall_unix.go:118:7: undefined: unsafe.Slice
Error: ../../../go/pkg/mod/golang.org/x/sys@v0.6.0/unix/sysvshm_unix.go:33:7: undefined: unsafe.Slice
note: module requires Go 1.17

Oops... let's update to Go 1.17...

toga4 commented 1 year ago

Somehow go test succeeded on my machine, because I am on a Mac...? Anyway I did it ;)

yfuruyama commented 1 year ago

Finally the test has passed! I'll merge into master.

Thank you so much for continuously fixing the problem! 🙏