Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

crazytan/bazel-to-dep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This package helps to migrate a Bazel-managed Go project to a dep-managed one. It converts go_repository rules in a valid Bazel WORKSPACE file into dep constraints. The [[constraint]] rules are appended to the current Gopkg.toml file, if any. Some implicit dependencies are added automatically by Bazel if you already use go_rules_dependencies() and you may want to add them to Gopkg.toml manually. See here for a complete list.

Usage:

$ go get github.com/crazytan/bazel-to-go
$ go run $GOPATH/github.com/crazytan/bazel-to-go/main.go <project path>

Example

WORKSPACE file:

go_repository(
    name = "com_github_spf13_pflag",
    commit = "4c012f6dcd9546820e378d0bdda4d8fc772cdfea",
    importpath = "github.com/spf13/pflag",
)
go_repository(
    name = "com_github_spf13_cobra",
    commit = "f91529fc609202eededff4de2dc0ba2f662240a3",
    importpath = "github.com/spf13/cobra",
)

will be converted to

[[constraint]]
  name = "github.com/spf13/pflag"
  revision = "4c012f6dcd9546820e378d0bdda4d8fc772cdfea"

[[constraint]]
  name = "github.com/spf13/cobra"
  revision = "f91529fc609202eededff4de2dc0ba2f662240a3"

About

Convert bazel Go rules to dep constraints

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages