Skip to content

Commit d4fd5a9

Browse files
committed
Create README.md
1 parent 65c72f8 commit d4fd5a9

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
This repo is _merely_ a function, exported as it was a library. Its main purpose is to explore Go modules internals.
2+
Modules is the most [recent](https://blog.golang.org/using-go-modules) way of managing dependencies in Go. From version 1.13+ modules became the default.
3+
4+
This repo was first made private. Now it's public so you can use it to learn more. I hope it works for your private repos too. I believe there are different ways to solve this problem. :)
5+
6+
## Resolving private dependencies
7+
8+
### Configurations
9+
10+
#### Environment variable
11+
12+
`export GOPRIVATE="github.com/<username>,github.com/<username>,github.com/<username>"`
13+
14+
Notice that it allows you to define multiple repos.
15+
16+
#### Enforcing SSH via Git
17+
18+
`git config --global url."ssh://[email protected]/".insteadOf "https://github.com/"`
19+
20+
Now, if you want to use it in another project, run the following:
21+
22+
`go get -v github.com/axcdnt/go-mod-internals`
23+
24+
The go.mod must be correctly updated with the code from this lib.
25+
26+
Dependencies resolved, it's now possible to import and use it:
27+
28+
```
29+
package main
30+
31+
import "github.com/axcdnt/go-mod-internals/stringer"
32+
33+
func main() {
34+
stringer.Tokenize("what a cool string") // ["what", "a", "cool", "string"]
35+
}
36+
37+
```
38+
39+
For more details, please check [Go 1.13](https://golang.org/doc/go1.13#modules).

0 commit comments

Comments
 (0)