Skip to content

Commit 61fbf60

Browse files
authored
make Package.Path() return platform independent package full path (#151)
* add .gitattributes for clean checkout on Windows * fix Package.Path() * update README * update typo
1 parent 16ea027 commit 61fbf60

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Set default behavior to automatically normalize line endings.
2+
* text=auto
3+
4+
# Force batch scripts to always use CRLF line endings so that if a repo is accessed
5+
# in Windows via a file share from Linux, the scripts will work.
6+
*.{cmd,[cC][mM][dD]} text eol=crlf
7+
*.{bat,[bB][aA][tT]} text eol=crlf
8+
9+
# Force bash scripts to always use LF line endings so that if a repo is accessed
10+
# in Unix via a file share from Windows, the scripts will work.
11+
*.sh text eol=lf

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ run:
122122
123123
Let's show a few, real, sometimes novel examples showcasing `bingo` capabilities:
124124
125-
1. [`golangci-lint`](https://github.com/golangci/golangci-lint) is all-in-one lint framework. It's important to pin it on CI so CI runs are reproducible no matter what new linters are added, removed or changed in new release. Let's pin it to `v1.35.2` and use path recommended by https://golangci-lint.run/usage/install/#install-from-source doc: ` github.com/golangci/golangci-lint/cmd/golangci-lint` (funny enough they discourage `go get` exactly because of the lack of pinning features `bingo` have!)
125+
1. [`golangci-lint`](https://github.com/golangci/golangci-lint) is all-in-one lint framework. It's important to pin it on CI so CI runs are reproducible no matter what new linters are added, removed or changed in new release. Let's pin it to `v1.35.2` and use path recommended by https://golangci-lint.run/welcome/install/#install-from-source doc: ` github.com/golangci/golangci-lint/cmd/golangci-lint` (funny enough they discourage `go get` exactly because of the lack of pinning features `bingo` have!)
126126
127127
```shell
128128
bingo get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.35.2

pkg/bingo/mod.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"io"
1010
"log"
1111
"os"
12+
"path"
1213
"path/filepath"
1314
"sort"
1415
"strings"
@@ -70,9 +71,10 @@ func (m Package) String() string {
7071
return m.Path() + "@" + m.Module.Version
7172
}
7273

73-
// Path returns a full package path.
74+
// Path returns a full package path. package path is platform independent, usually in
75+
// the form of "a/b/c" with forward slashes
7476
func (m Package) Path() string {
75-
return filepath.Join(m.Module.Path, m.RelPath)
77+
return path.Join(m.Module.Path, m.RelPath)
7678
}
7779

7880
// ModFile is a wrapper over module file with bingo specific data.

0 commit comments

Comments
 (0)