Skip to content

Commit

Permalink
cmd/pluginpkg: support relative path (pingcap#10205)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdojjy authored and lysu committed Apr 22, 2019
1 parent 8d8bfcc commit 8ec262c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/pluginpkg/pluginpkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,19 @@ func main() {
if pkgDir == "" || outDir == "" {
flag.Usage()
}
pkgDir, err := filepath.Abs(pkgDir)
if err != nil {
log.Printf("unable to resolve absolute representation of package path , %+v\n", err)
flag.Usage()
}
outDir, err := filepath.Abs(outDir)
if err != nil {
log.Printf("unable to resolve absolute representation of output path , %+v\n", err)
flag.Usage()
}

var manifest map[string]interface{}
_, err := toml.DecodeFile(filepath.Join(pkgDir, "manifest.toml"), &manifest)
_, err = toml.DecodeFile(filepath.Join(pkgDir, "manifest.toml"), &manifest)
if err != nil {
log.Printf("read pkg %s's manifest failure, %+v\n", pkgDir, err)
os.Exit(1)
Expand Down Expand Up @@ -150,6 +161,7 @@ func main() {
"-ldflags", pluginPath,
"-buildmode=plugin",
"-o", outputFile, pkgDir)
buildCmd.Dir = pkgDir
buildCmd.Stderr = os.Stderr
buildCmd.Stdout = os.Stdout
buildCmd.Env = append(os.Environ(), "GO111MODULE=on")
Expand Down

0 comments on commit 8ec262c

Please sign in to comment.