Skip to content

Commit

Permalink
fix(hz): template import alias (#1093)
Browse files Browse the repository at this point in the history
#### What type of PR is this?
<!--
Add one of the following kinds:

build: Changes that affect the build system or external dependencies
(example scopes: gulp, broccoli, npm)
ci: Changes to our CI configuration files and scripts (example scopes:
Travis, Circle, BrowserStack, SauceLabs)
docs: Documentation only changes
feat: A new feature
optimize: A new optimization
fix: A bug fix
perf: A code change that improves performance
refactor: A code change that neither fixes a bug nor adds a feature
style: Changes that do not affect the meaning of the code (white space,
formatting, missing semi-colons, etc)
test: Adding missing tests or correcting existing tests
chore: Changes to the build process or auxiliary tools and libraries
such as documentation generation
-->
fix

#### Check the PR title.
<!--
The description of the title will be attached in Release Notes, 
so please describe it from user-oriented, what this PR does / why we
need it.
Please check your PR title with the below requirements:
-->
- [x] This PR title match the format: \<type\>(optional scope):
\<description\>
- [x] The description of this PR title is user-oriented and clear enough
for others to understand.
- [x] Attach the PR updating the user documentation if the current PR
requires user awareness at the usage level. [User docs
repo](https://github.com/cloudwego/cloudwego.github.io)


#### (Optional) Translate the PR title into Chinese.
fix customized template import alias error

#### (Optional) More detailed description for this PR(en: English/zh:
Chinese).
<!--
Provide more detailed info for review(e.g., it's recommended to provide
perf data if this is a perf type PR).
-->
en:
zh(optional): customized template import alias error

#### (Optional) Which issue(s) this PR fixes:
<!--
Automatically closes linked issue when PR is merged.
Eg: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

#### (Optional) The PR that updates user documentation:
<!--
If the current PR requires user awareness at the usage level, please
submit a PR to update user docs. [User docs
repo](https://github.com/cloudwego/cloudwego.github.io)
-->
  • Loading branch information
FGYFFFF authored Apr 19, 2024
2 parents 0285a34 + 9858163 commit bd2a9b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/hz/generator/custom_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func getInsertImportContent(tplInfo *Template, renderInfo interface{}, fileConte
}
imptSlice = append(imptSlice, [2]string{"", impt[1 : len(impt)-1]})
} else { // 3. alias "import"
idx := strings.Index(impt, "\n")
idx := strings.Index(impt, "\"")
if idx == -1 {
return nil, fmt.Errorf("error import format for file: %s", tplInfo.Path)
}
Expand Down

0 comments on commit bd2a9b2

Please sign in to comment.