@@ -10,6 +10,8 @@ A collection of small helpers around Go proxy, Go meta information, etc.
10
10
11
11
A small Go proxy client to get information about a module from a Go proxy.
12
12
13
+ <details ><summary >Example</summary >
14
+
13
15
``` go
14
16
package main
15
17
@@ -31,10 +33,14 @@ func main() {
31
33
}
32
34
```
33
35
36
+ </details >
37
+
34
38
## metago
35
39
36
40
A small lib to fetch meta information (` go-import ` , ` go-source ` ) for a module.
37
41
42
+ <details ><summary >Example</summary >
43
+
38
44
``` go
39
45
package main
40
46
@@ -54,10 +60,14 @@ func main() {
54
60
}
55
61
```
56
62
63
+ </details >
64
+
57
65
## Version
58
66
59
67
Gets information about releases and build.
60
68
69
+ <details ><summary >Examples</summary >
70
+
61
71
``` go
62
72
package main
63
73
@@ -97,6 +107,121 @@ func main() {
97
107
}
98
108
```
99
109
110
+ </details >
111
+
100
112
## SumDB
101
113
102
114
- I recommend using the package [ sumdb] ( https://pkg.go.dev/golang.org/x/mod/sumdb?tab=doc )
115
+
116
+
117
+ ## gomod
118
+
119
+ A set of functions to get information about module (` go list ` /` go env ` ).
120
+
121
+ <details ><summary >Examples</summary >
122
+
123
+ ``` go
124
+ package main
125
+
126
+ import (
127
+ " fmt"
128
+
129
+ " github.com/ldez/grignotin/gomod"
130
+ )
131
+
132
+ func main () {
133
+ info , err := gomod.GetModuleInfo ()
134
+ if err != nil {
135
+ panic (err)
136
+ }
137
+
138
+ fmt.Println (info)
139
+ }
140
+ ```
141
+
142
+ ``` go
143
+ package main
144
+
145
+ import (
146
+ " fmt"
147
+
148
+ " github.com/ldez/grignotin/gomod"
149
+ )
150
+
151
+ func main () {
152
+ modpath , err := gomod.GetModulePath ()
153
+ if err != nil {
154
+ panic (err)
155
+ }
156
+
157
+ fmt.Println (modpath)
158
+ }
159
+
160
+ ```
161
+
162
+ </details >
163
+
164
+ ## goenv
165
+
166
+ A set of functions to get information from ` go env ` .
167
+
168
+ <details ><summary >Examples</summary >
169
+
170
+ ``` go
171
+ package main
172
+
173
+ import (
174
+ " fmt"
175
+
176
+ " github.com/ldez/grignotin/goenv"
177
+ )
178
+
179
+ func main () {
180
+ value , err := goenv.GetOne (goenv.GOMOD )
181
+ if err != nil {
182
+ panic (err)
183
+ }
184
+
185
+ fmt.Println (value)
186
+ }
187
+ ```
188
+
189
+ ``` go
190
+ package main
191
+
192
+ import (
193
+ " fmt"
194
+
195
+ " github.com/ldez/grignotin/goenv"
196
+ )
197
+
198
+ func main () {
199
+ values , err := goenv.Get (goenv.GOMOD , goenv.GOMODCACHE )
200
+ if err != nil {
201
+ panic (err)
202
+ }
203
+
204
+ fmt.Println (values)
205
+ }
206
+ ```
207
+
208
+ ``` go
209
+ package main
210
+
211
+ import (
212
+ " fmt"
213
+
214
+ " github.com/ldez/grignotin/goenv"
215
+ )
216
+
217
+ func main () {
218
+ values , err := goenv.GetAll ()
219
+ if err != nil {
220
+ panic (err)
221
+ }
222
+
223
+ fmt.Println (values)
224
+ }
225
+ ```
226
+
227
+ </details >
0 commit comments