-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract psapi into github.com/planetscale/planetscale-go #27
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iheanyi
approved these changes
Jan 11, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
fatih
added a commit
that referenced
this pull request
Jan 11, 2021
The following improvements have been made: * Updated the Go version from 1.13 to 1.15. This is done for two reason. First, we should always aim to use the latest version, this is a common theme in Go projects and each version provides more performance or overall UX improvements we need. Second, starting with Go 1.14, the `go` commandline CLI now automatically detects the `vendor/` folder and uses that during `go build` and `go test`. This is needed so the CI detects any inconsistencies during a pull request and that the source code is 100% buildable. * I removed the `Get dependencies` part because we're vendoring the source code and `go get` makes a network call to fetch dependencies. We don't need to fetch the dependencies again, because our source of truth is the `vendor/` folder. Also, this particular step breaks our CI if we start using private dependencies (i.e: #27). We could configure our CI to easily so `go get` could work easily, but I'm not sure we need it at all due the usage of `vendor/` * I removed the `-v` flag from `go test -v`. The main reason is that `-v` outputs to much information. It' s not needed. The best outcome is to output only the issues we see. The benefit is, it's easier to parse the CI output for humans and we don't have to scroll hundreds of lines. (nit: the pictures are attached to the GitHub Pull Request, please find the appropriate PR and check that it out there :)) Before: ``` ``` After: ``` ```
The CI is failing because it tries to fetch a private dependency and it doesn't have access to it. Because we're vendoring our dependencies into |
This PR extracts the PlanetScale Go API client from this repo into github.com/planetscale/planetscale-go. The repo is already ready for use, so we also migrate with this PR by removing `psapi` and using this new package. This is needed for several reasons: * Other Go services at PlanetScale also need to interact with the public API, hence these services should be able to use the Go API client without having to rely on the CLI. The first service to use this new API will be https://github.com/planetscale/sql-proxy, which is required to fetch databases and * We eventually want to release an Open-Source Go library for the developer community. People will not only use our CLI; they will also create various kinds of services, and having an official Go client will make it simpler for them to create new tools. Almost all "cloud" specific tools are written in Go. In addition to this, automation tools like `Terraform` will also need a Go client in the future if we want to add Terraform support for PlanetScale DB. A couple of notes that will change our workflow: * Because the Go package (planetscale-go) is still private, locally you'll have to configure Go. By default, Go will try to access the default Go module proxy (https:/proxy.golang.org). Because the package is private, it'll throw an error (this will only happen if you re-download the package). To fix the error, you need to configure Go, so it doesn't contact the proxy for our private package. Luckily executing a single command can do it: ``` go env -w GOPRIVATE="github.com/planetscale/*" ``` * There is no versioning yet for the `planetscale-go` package. Because we're going to change/break things until everything is fleshed out, you'll see that the version in `go.mod` is something like: `v0.0.0-20210109112707-8edffde9c156`. * If you want to add a new endpoint or new functionality, you'll have to add it to `planetscale-go`. To use them in the CLI, you can download and vendor the latest release with: ``` go get github.com/planetscale/planetscale-go go mod vendor ```
fatih
force-pushed
the
fatih/extract-cli
branch
from
January 11, 2021 19:42
763ea74
to
80cb186
Compare
asbiaidw5
added a commit
to asbiaidw5/cli
that referenced
this pull request
Aug 6, 2024
The following improvements have been made: * Updated the Go version from 1.13 to 1.15. This is done for two reason. First, we should always aim to use the latest version, this is a common theme in Go projects and each version provides more performance or overall UX improvements we need. Second, starting with Go 1.14, the `go` commandline CLI now automatically detects the `vendor/` folder and uses that during `go build` and `go test`. This is needed so the CI detects any inconsistencies during a pull request and that the source code is 100% buildable. * I removed the `Get dependencies` part because we're vendoring the source code and `go get` makes a network call to fetch dependencies. We don't need to fetch the dependencies again, because our source of truth is the `vendor/` folder. Also, this particular step breaks our CI if we start using private dependencies (i.e: planetscale/cli#27). We could configure our CI to easily so `go get` could work easily, but I'm not sure we need it at all due the usage of `vendor/` * I removed the `-v` flag from `go test -v`. The main reason is that `-v` outputs to much information. It' s not needed. The best outcome is to output only the issues we see. The benefit is, it's easier to parse the CI output for humans and we don't have to scroll hundreds of lines. (nit: the pictures are attached to the GitHub Pull Request, please find the appropriate PR and check that it out there :)) Before: ``` ``` After: ``` ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR extracts the PlanetScale Go API client from this repo into github.com/planetscale/planetscale-go. The repo is already ready for use, so we also migrate with this PR by removing
psapi
and using this new package.Extracting the API package is needed for several reasons:
Terraform
will also need a Go client in the future if we want to add Terraform support for PlanetScale DB.A couple of notes that will change our workflow:
There is no versioning yet for the
planetscale-go
package. Because we're going to change/break things until everything is fleshed out, you'll see that the version ingo.mod
is something like:v0.0.0-20210109112707-8edffde9c156
. I want us to iterate fastly without dealing with versioning/releasing. We're going to release and make it open source once it's ready for prime time.If you want to add a new endpoint or new functionality, you'll first extend the API package and add them to
planetscale-go
. Once that is finished, to use the new functionality here in the CLI, you can download and vendor the latest release with: