File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -34,4 +34,32 @@ You can achieve this by adding the right version of `go` to your `PATH`
34
34
(` export PATH=$HOME/go/bin:$PATH ` on Unix systems) or by configuring your
35
35
editor.
36
36
37
+ ## Working with generic code
38
+
39
+ Gopls has experimental support for generic Go, as defined by the type
40
+ parameters proposal ([ golang/go #43651 ] ( https://golang.org/issues/43651 ) ) and
41
+ type set addendum ([ golang/go #45346 ] ( https://golang.org/issues/45346 ) ).
42
+
43
+ To enable this support, you need to build gopls with a version of Go that
44
+ supports type parameters: the
45
+ [ dev.typeparams branch] ( https://github.com/golang/go/tree/dev.typeparams ) . This
46
+ can be done by checking out this branch in the Go repository, or by using
47
+ ` golang.org/dl/gotip ` :
48
+
49
+ ```
50
+ $ go get golang.org/dl/gotip
51
+ $ gotip download dev.typeparams
52
+ ```
53
+
54
+ For building gopls with type parameter support, it is recommended that you
55
+ build gopls at tip. External APIs are under active development on the
56
+ ` dev.typeparams ` branch, so building gopls at tip minimizes the chances of
57
+ a build failure (though it is still possible). To get enhanced gopls features
58
+ for generic code, build gopls with the ` typeparams ` build constraint (though
59
+ this increases your chances of a build failure).
60
+
61
+ ```
62
+ $ GO111MODULE=on gotip get -tags=typeparams golang.org/x/tools/gopls@master golang.org/x/tools@master
63
+ ```
64
+
37
65
[ Go project ] : https://go.googlesource.com/go
You can’t perform that action at this time.
0 commit comments