Skip to content
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

chore: improve windows support #110

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions pkgs/amino/pkg/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package pkg

import (
"fmt"
"path"
"path/filepath"
"reflect"
"regexp"
"runtime"
Expand Down Expand Up @@ -79,10 +79,10 @@ func NewPackage(gopkgPath string, p3pkgName string, dirName string) *Package {
DirName: dirName,
Dependencies: nil,
Types: nil,
P3GoPkgPath: path.Join(gopkgPath, "pb"),
P3GoPkgPath: filepath.Join(gopkgPath, "pb"),
P3PkgName: p3pkgName,
P3ImportPath: path.Join(gopkgPath, gopkgName+".proto"),
P3SchemaFile: path.Join(dirName, gopkgName+".proto"),
P3ImportPath: filepath.Join(gopkgPath, gopkgName+".proto"),
P3SchemaFile: filepath.Join(dirName, gopkgName+".proto"),
}
return pkg
} else {
Expand All @@ -108,8 +108,8 @@ func (pkg *Package) WithGoPkgName(name string) *Package {
// The following fields must also be updated.
// TODO: make P3ImportPath and P3SchemaFile lazy,
// so it never gets out of sync.
pkg.P3ImportPath = path.Join(pkg.GoPkgPath, name+".proto")
pkg.P3SchemaFile = path.Join(pkg.DirName, name+".proto")
pkg.P3ImportPath = filepath.Join(pkg.GoPkgPath, name+".proto")
pkg.P3SchemaFile = filepath.Join(pkg.DirName, name+".proto")
return pkg
}

Expand Down Expand Up @@ -301,7 +301,7 @@ func GetCallersDirname() string {
if !ok {
panic("could not get caller to derive caller's package directory")
}
dirName = path.Dir(filename)
dirName = filepath.Dir(filename)
if filename == "" || dirName == "" {
panic("could not derive caller's package directory")
}
Expand Down Expand Up @@ -346,11 +346,11 @@ func assertValidDirName(dirName string) {
// DirName should not be set to "." or "./".
return
}
if !path.IsAbs(dirName) {
if !filepath.IsAbs(dirName) {
panic(fmt.Sprintf("dirName if present should be absolute, but got %v", dirName))
}
if path.Dir(dirName+"/dummy") != dirName {
panic(fmt.Sprintf("dirName not canonical. got %v, expected %v", dirName, path.Dir(dirName+"/dummy")))
if filepath.Dir(dirName+"/dummy") != dirName {
panic(fmt.Sprintf("dirName not canonical. got %v, expected %v", dirName, filepath.Dir(dirName+"/dummy")))
}
}

Expand Down