|
@@ -20,6 +20,7 @@ import (
|
|
|
"path/filepath"
|
|
"path/filepath"
|
|
|
"regexp"
|
|
"regexp"
|
|
|
"strconv"
|
|
"strconv"
|
|
|
|
|
+ "strings"
|
|
|
"text/template"
|
|
"text/template"
|
|
|
"time"
|
|
"time"
|
|
|
)
|
|
)
|
|
@@ -135,6 +136,16 @@ func Generate(outfile, buildTag, codecPkgPath string, uid int64, useUnsafe bool,
|
|
|
if tv.ImportPath == tv.CodecImportPath {
|
|
if tv.ImportPath == tv.CodecImportPath {
|
|
|
tv.CodecPkgFiles = true
|
|
tv.CodecPkgFiles = true
|
|
|
tv.CodecPkgName = "codec"
|
|
tv.CodecPkgName = "codec"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // HACK: always handle vendoring. It should be typically on in go 1.6, 1.7
|
|
|
|
|
+ s := tv.ImportPath
|
|
|
|
|
+ const vendorStart = "vendor/"
|
|
|
|
|
+ const vendorInline = "/vendor/"
|
|
|
|
|
+ if i := strings.LastIndex(s, vendorInline); i >= 0 {
|
|
|
|
|
+ tv.ImportPath = s[i+len(vendorInline):]
|
|
|
|
|
+ } else if strings.HasPrefix(s, vendorStart) {
|
|
|
|
|
+ tv.ImportPath = s[len(vendorStart):]
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
astfiles := make([]*ast.File, len(infiles))
|
|
astfiles := make([]*ast.File, len(infiles))
|
|
|
for i, infile := range infiles {
|
|
for i, infile := range infiles {
|