Skip to content

Commit 08db007

Browse files
committed
Fix golint errors
Add mount package to hack/.golint_failures to ignore stuttering errors.
1 parent 957b43f commit 08db007

File tree

4 files changed

+30
-24
lines changed

4 files changed

+30
-24
lines changed

hack/.golint_failures

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
# Apart from this line, only trailing comments are supported
2+
mount

hack/verify-golint.sh

+23-24
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ unset IFS
4646
errors=()
4747
not_failing=()
4848
for p in "${all_packages[@]}"; do
49-
failing_packages="${failing_packages:-}"
5049
# Run golint on package/*.go file explicitly to validate all go files
5150
# and not just the ones for the current platform. This also will ensure that
5251
# _test.go files are linted.
@@ -90,26 +89,26 @@ else
9089
exit 1
9190
fi
9291

93-
# if [[ ${#not_failing[@]} -gt 0 ]]; then
94-
# {
95-
# echo "Some packages in hack/.golint_failures are passing golint. Please remove them."
96-
# echo
97-
# for p in "${not_failing[@]}"; do
98-
# echo " $p"
99-
# done
100-
# echo
101-
# } >&2
102-
# exit 1
103-
# fi
104-
#
105-
# if [[ ${#gone[@]} -gt 0 ]]; then
106-
# {
107-
# echo "Some packages in hack/.golint_failures do not exist anymore. Please remove them."
108-
# echo
109-
# for p in "${gone[@]}"; do
110-
# echo " $p"
111-
# done
112-
# echo
113-
# } >&2
114-
# exit 1
115-
# fi
92+
if [[ ${#not_failing[@]} -gt 0 ]]; then
93+
{
94+
echo "Some packages in hack/.golint_failures are passing golint. Please remove them."
95+
echo
96+
for p in "${not_failing[@]}"; do
97+
echo " $p"
98+
done
99+
echo
100+
} >&2
101+
exit 1
102+
fi
103+
104+
if [[ ${#gone[@]} -gt 0 ]]; then
105+
{
106+
echo "Some packages in hack/.golint_failures do not exist anymore. Please remove them."
107+
echo
108+
for p in "${gone[@]}"; do
109+
echo " $p"
110+
done
111+
echo
112+
} >&2
113+
exit 1
114+
fi

mount/fake_mounter.go

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type FakeMounter struct {
3636
UnmountFunc UnmountFunc
3737
}
3838

39+
// UnmountFunc is a function callback to be executed during the Unmount() call.
3940
type UnmountFunc func(path string) error
4041

4142
var _ Interface = &FakeMounter{}
@@ -55,6 +56,8 @@ type FakeAction struct {
5556
FSType string // applies only to "mount" actions
5657
}
5758

59+
// NewFakeMounter returns a FakeMounter struct that implements Interface and is
60+
// suitable for testing purposes.
5861
func NewFakeMounter(mps []MountPoint) *FakeMounter {
5962
return &FakeMounter{
6063
MountPoints: mps,

mount/mount_helper_windows.go

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ func IsCorruptedMnt(err error) bool {
7070
return false
7171
}
7272

73+
// NormalizeWindowsPath makes sure the given path is a valid path on Windows
74+
// systems by making sure all instances of `/` are replaced with `\\`, and the
75+
// path beings with `c:`
7376
func NormalizeWindowsPath(path string) string {
7477
normalizedPath := strings.Replace(path, "/", "\\", -1)
7578
if strings.HasPrefix(normalizedPath, "\\") {

0 commit comments

Comments
 (0)