github.com/nickwells/filecheck.mod v1.2.16
Go module source archive layoutArchive contains go.mod
SHA-25677fcf0dff3cbfafa0cf3da67b5dbdd1ab57ce681fe96882cee9b53104f7106e6
MaleculeH(F)Md(Pa₂)
Evidence
1package tempus
2
3import (
4 "archive/zip"
5 "os"
6 "os/exec"
7 "path/filepath"
8 "strings"
9)
10
⋯6 lines
17 }
18
19 out, err := exec.Command(goPath, "env", "GOROOT").Output() //nolint:gosec
20 if err != nil {
21 return
⋯9 lines
52:22… []string {
53 if !HasTimezoneInfo() {
54 return nil
55 }
56
57 r, err := zip.OpenReader(zoneInfoFile)
58 if err != nil {
59 return nil
60 }
61
62 zones := make([]string, 0, tzCount)
63 for _, f := range r.File {
64 zones = append(zones, f.Name)
65 }
66
67 return zones
68}
1package filecheck_test
2
3import (
4 "os"
5 "testing"
6
7 "github.com/nickwells/check.mod/v2/check"
8 "github.com/nickwells/filecheck.mod/filecheck"
9 "github.com/nickwells/testhelper.mod/v2/testhelper"
10)
11
12func TestStatusCheck(t *testing.T) {
13 const (
14 noSuchFile = "testdata/nonesuch"
15 isAFile = "testdata/IsAFile"
16 …
18 symlinkToNothing = "testdata/IsASymlinkToNothing"
19 )
20
21 err := os.Chmod(isAFile600, 0o600) // force the file mode
22 if err != nil {
23 t.Fatalf("Cannot set the file permission bits on %q: %s\n",
24 isAF …
108:23… rmissions (0600) should equal 0644"),
109 },
110 }
111
112 for _, tc := range testCases {
113 err := tc.p.StatusCheck(tc.fileName)
114 testhelper.CheckExpErr(t, err, tc)
115 }
116}
117
118func TestProvisosToString(t *testing.T) {
119 testCases := []struct {
120 testhelper.ID
121 p filecheck.Provisos
122 exp …
No evidence locations were recorded for this file. Raw result