Skip to content

Commit

Permalink
Merge pull request #821 from go-swagger/baseimport-ci-windows
Browse files Browse the repository at this point in the history
allow for gopath to be differently cased from actual
  • Loading branch information
casualjim committed Dec 26, 2016
2 parents d80f2e2 + f9dcfab commit b85acd0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions generator/support.go
Expand Up @@ -22,6 +22,7 @@ import (
"os"
"path/filepath"
"regexp"
goruntime "runtime"
"sort"
"strings"

Expand Down Expand Up @@ -150,8 +151,13 @@ func baseImport(tgt string) string {

var pth string
for _, gp := range filepath.SplitList(os.Getenv("GOPATH")) {
pp := filepath.Join(gp, "src")
if strings.HasPrefix(p, pp) {
pp := filepath.Join(filepath.Clean(gp), "src")
var np, npp string
if goruntime.GOOS == "windows" {
np = strings.ToLower(p)
npp = strings.ToLower(pp)
}
if strings.HasPrefix(np, npp) {
pth, err = filepath.Rel(pp, p)
if err != nil {
log.Fatalln(err)
Expand Down

0 comments on commit b85acd0

Please sign in to comment.