Closed suntong closed 4 years ago
The formatting logic is already fully contained in the cockroach code which you can call as a normal go package. Note: cockroach isn't go-gettable so would need to use https://github.com/cockroachdb/cockroach-gen with a replace directive in your go.mod. This sqlfmt repo is just the web frontend.
Gotya. thx a lot for the explanation!
I've been poking around and am having trouble seeing the correct way to do this. Is it possible that we could get a quick example? maybe in the README?
For example, I'm trying to grab the pertinent parts of main.go
and use them with a replace directive
replace github.com/cockroachdb/cockroach => github.com/cockroachdb/cockroach-gen/v20 v20.2.4
but I'm getting the following error:
go: downloading github.com/cockroachdb/cockroach-gen/v20 v20.2.4
stash.teslamotors.com/cas/ion/lineside/cmd/internal/pretty_log imports
github.com/cockroachdb/cockroach/pkg/sql/parser: go.mod has non-.../v20 module path "github.com/cockroachdb/cockroach" (and .../v20/go.mod does not exist) at revision v20.2.4
stash.teslamotors.com/cas/ion/lineside/cmd/internal/pretty_log imports
github.com/cockroachdb/cockroach/pkg/sql/sem/builtins: go.mod has non-.../v20 module path "github.com/cockroachdb/cockroach" (and .../v20/go.mod does not exist) at revision v20.2.4
stash.teslamotors.com/cas/ion/lineside/cmd/internal/pretty_log imports
github.com/cockroachdb/cockroach/pkg/sql/sem/tree: go.mod has non-.../v20 module path "github.com/cockroachdb/cockroach" (and .../v20/go.mod does not exist) at revision v20.2.4
Hi Matt,
Any plan to split out the formatting part out to a module?