Closed phsym closed 1 year ago
Hum ok, maybe I shouldn't have update all dependencies, some may not be go 1.16 compatible anymore, let me try to fix that
Looks like latest golang.org/x/tools requires a version golang.org/x/sys which itself requires unsafe.Slice
from stdlib which has been added in go 1.17.
Would you be OK to drop go 1.16 compatibility ?
I removed go 1.16 from the github actions ci and it passed
@JohnStarich here's a quick example where it fails before this PR. I'll look at how to make this a test case
// Package example is a dummy package showing how comments doc is rendered.
//
// Here are some random doc links:
// - Std library: [os.File] [*os.File] [encoding/xml.Encoder]
// - Std imported: [json.Decoder] [json.Encoder]
// - Packages: [os] [json] [encoding/xml]
package example
import (
"encoding/json"
)
// JSONFunc does random stuff with [json.Decoder] & [json.Encoder]
func JSONFunc() {
json.Marshal("foobar") // Just to import json
}
Not all doc-links are rendered as links, and those which are links to localhost/
After PR, links are properly rendered, a linked to pkg.go.dev when they are external dependencies (internal links are linked properly too, will add them to my test case)
I added a test case in gopages/internal/generate/generate_test.go
EDIT: I had to skip this test case when running in go version prior to 1.19
I've released v0.1.20
with your change 🎉
Hi ! Thanks for this awesome gopages tool. I love it already.
I followed your recent note about go 1.19 and improved formatting, however I realized that doclinks where not rendered at all so I took the chance to try to improve your tool.
To achieve that I did 2 things :
By the way I also upgraded other libs but maybe I was wrong, just tell me and I'll revert. I haven't updated the go version to 1.19 in go.mod. Not sure if it's neededcomment_html
template func the same way you did for thenode_html
template func so that it properly rewrite the doclinks. For some reason, unlike node_html links, doclinks are not prefixed by /pkgI tried it on my codebase (sorry I can't share the full result) but here's a quick example
Without the change:
With the change
With the link properly sending to
http://<host>:<port>/pkg/<module>/<package>/#New
DocLinks to doc from other modules or stdlib redirect to pkg.go.dev