mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 09:00:20 +08:00
fix issue: https://github.com/zeromicro/goctl-swagger/issues/6 (#680)
This commit is contained in:
parent
a5962f677f
commit
d28ac35ff7
@ -18,6 +18,7 @@ type (
|
||||
debug bool
|
||||
log console.Console
|
||||
antlr.DefaultErrorListener
|
||||
src string
|
||||
}
|
||||
|
||||
// ParserOption defines an function with argument Parser
|
||||
@ -94,7 +95,8 @@ func (p *Parser) parse(filename, content string) (*Api, error) {
|
||||
var apiAstList []*Api
|
||||
apiAstList = append(apiAstList, root)
|
||||
for _, imp := range root.Import {
|
||||
path := imp.Value.Text()
|
||||
dir := filepath.Dir(p.src)
|
||||
path := filepath.Join(dir, imp.Value.Text())
|
||||
data, err := p.readContent(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -420,6 +422,7 @@ func (p *Parser) readContent(filename string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
p.src = abs
|
||||
data, err := ioutil.ReadFile(abs)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
Loading…
Reference in New Issue
Block a user