-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Go 1.7: {{if}} branches end in different contexts #2331
Comments
strange, I can't seem to be able to reproduce that. Not in new install, not in existing one. Built with |
Here I have go version go1.7.4 linux/amd64 The other specificity of my install is that I'm using an existing PostgreSQL database, with a user in it. |
I can still reproduce with |
The template does indeed look weird, check this snippet:
What's that |
@strk It's from Vue.js. Do you use Chrome? Chrome has an intriguing caching now. Open your public/index.js in a seperate tab and reload. Maybe you have an old js file. |
Ok, anyway the problem is somewhere in here, at the top of templates/user/dashboard/repo-search.tmpl:
Removing the portion inside the condition, leaving the following, fixes it:
|
I can't reproduce that error as well. I am on latest master. My Go version is 1.8.3 |
What Go version are you using ? What else could be different ? |
As I said, Go version is 1.8.3 |
@lafriks are you also using Go 1.8 ? Both: any chance you can try an older version ?
|
@strk I will try with an older version, give me a moment. |
Ok I can confirm this issue with Go 1.7.4! |
Thanks for testing ! Should this be filed upstream to Vue ? (or can you tell where else the bug is ?) |
I don't think Vue is responsible for this. I'd rather say to file an issue at Golang for the bug in 1.7 ;-) |
From https://golang.org/pkg/html/template/:
Maybe we can try the dummy |
dummy |
I found this excerpt earlier today too, but thought that won't help in any way ;-) Why not just updating Go? |
There was a major change in text/template from Go 1.7.5 to 1.8.0 |
Go 1.7 is what is shipped by latest Long-Term-Support popular free unix distributions. |
Ok sorry, haven't thought about that. |
Most likely the issue is golang/go@ffd1c78 As the file in question is all wrapped in a <script>, 1.7.4 and before are treating it as JS, but 1.8 sees that it's not JS. Not sure how much you can do to fix it. |
Dropping the I'll note that this template is the only template using that |
I think the script tag exists because it is a Vue template and not a Go html/template. |
According to https://sebastiandedeyne.com/posts/2016/dealing-with-templates-in-vue-20 even documentation discourage from using the |
Comment from #go-nuts IRC channel:
|
@strk yes it is not best practice but currently it would be quite big task to move template out to Vue files/templates as it would need to create way to get translations to javascript + add webpack javascript build step. What could be done currently to support do not use Vue component but directly use Vue app for this. This would fix the go 1.7 problem |
@Morlinest can you for now make that vue component back to vue app so not to use script template so that Gitea can be compiled with GoLang 1.7 again? After 1.2 is released we should make correct solution with component moved to vue file and webpack build step |
If #2317 does not help, aslo try to include code from |
@Morlinest The problem is the <script>-tag. As it tells the templating engine of Go 1.7 to interpret this part as JS. Mentioned in #2331 (comment) |
@strk it will fix template compile error but will not fix rendering on 1.7 as it will escape translations as if they are part of javascript that is not correct. |
@Morlinest I think currently it is needed to change it back to Vue app |
OK, just |
Please try #2336 |
@Morlinest Fixes the issue 👍 |
@daviian Great, thanks for test. |
As of commit e08d1fc (current master branch) new installation fails with following error:
Gitea has been built with
go build
.The offending route is the default one (/) which is were you are directed right after install.
The text was updated successfully, but these errors were encountered: