Skip to content

Commit dfda469

Browse files
authored
Merge pull request #2415 from alexandear/enable-godot-linter
Enable godot linter; append dot at the end of comments
2 parents f62df65 + 5abbf92 commit dfda469

File tree

33 files changed

+77
-73
lines changed

33 files changed

+77
-73
lines changed

.golangci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ linters:
4848
# - goconst
4949
- gocritic
5050
# - gocyclo
51-
# - godot
51+
- godot
5252
# - godox
5353
# - goerr113
5454
- gofumpt
@@ -111,3 +111,7 @@ issues:
111111
# Allow using Uid, Gid in pkg/osutil.
112112
- path: "pkg/osutil/"
113113
text: "uid"
114+
# Disable some linters for test files.
115+
- path: _test\.go
116+
linters:
117+
- godot

cmd/limactl/gendoc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ weight: 3
116116
})
117117
}
118118

119-
// replaceAll replaces all occurrences of new with old, for all files in dir
119+
// replaceAll replaces all occurrences of new with old, for all files in dir.
120120
func replaceAll(dir, old, new string) error {
121121
logrus.Infof("Replacing %q with %q", old, new)
122122
return filepath.Walk(dir, func(path string, info fs.FileInfo, err error) error {

cmd/limactl/hostagent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func hostagentAction(cmd *cobra.Command, args []string) error {
112112
return ha.Run(cmd.Context())
113113
}
114114

115-
// syncer is implemented by *os.File
115+
// syncer is implemented by *os.File.
116116
type syncer interface {
117117
Sync() error
118118
}

cmd/limactl/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func handleExitCoder(err error) {
161161
}
162162
}
163163

164-
// WrapArgsError annotates cobra args error with some context, so the error message is more user-friendly
164+
// WrapArgsError annotates cobra args error with some context, so the error message is more user-friendly.
165165
func WrapArgsError(argFn cobra.PositionalArgs) cobra.PositionalArgs {
166166
return func(cmd *cobra.Command, args []string) error {
167167
err := argFn(cmd, args)

pkg/autostart/autostart.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var systemdTemplate string
2121
//go:embed io.lima-vm.autostart.INSTANCE.plist
2222
var launchdTemplate string
2323

24-
// CreateStartAtLoginEntry respect host OS arch and create unit file
24+
// CreateStartAtLoginEntry respect host OS arch and create unit file.
2525
func CreateStartAtLoginEntry(hostOS, instName, workDir string) error {
2626
unitPath := GetFilePath(hostOS, instName)
2727
if _, err := os.Stat(unitPath); err != nil && !errors.Is(err, os.ErrNotExist) {
@@ -40,8 +40,8 @@ func CreateStartAtLoginEntry(hostOS, instName, workDir string) error {
4040
return enableDisableService("enable", hostOS, GetFilePath(hostOS, instName))
4141
}
4242

43-
// DeleteStartAtLoginEntry respect host OS arch and delete unit file
44-
// return true, nil if unit file has been deleted
43+
// DeleteStartAtLoginEntry respect host OS arch and delete unit file.
44+
// Return true, nil if unit file has been deleted.
4545
func DeleteStartAtLoginEntry(hostOS, instName string) (bool, error) {
4646
unitPath := GetFilePath(hostOS, instName)
4747
if _, err := os.Stat(unitPath); err != nil {
@@ -56,7 +56,7 @@ func DeleteStartAtLoginEntry(hostOS, instName string) (bool, error) {
5656
return true, nil
5757
}
5858

59-
// GetFilePath returns the path to autostart file with respect of host
59+
// GetFilePath returns the path to autostart file with respect of host.
6060
func GetFilePath(hostOS, instName string) string {
6161
var fileTmpl string
6262
if hostOS == "darwin" { // launchd plist

pkg/bicopy/bicopy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
)
2828

2929
// Bicopy is from https://github.com/rootless-containers/rootlesskit/blob/v0.10.1/pkg/port/builtin/parent/tcp/tcp.go#L73-L104
30-
// (originally from libnetwork, Apache License 2.0)
30+
// (originally from libnetwork, Apache License 2.0).
3131
func Bicopy(x, y io.ReadWriter, quit <-chan struct{}) {
3232
type closeReader interface {
3333
CloseRead() error

pkg/downloader/downloader.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import (
2323
"github.com/sirupsen/logrus"
2424
)
2525

26-
// HideProgress is used only for testing
26+
// HideProgress is used only for testing.
2727
var HideProgress bool
2828

29-
// hideBar is used only for testing
29+
// hideBar is used only for testing.
3030
func hideBar(bar *pb.ProgressBar) {
3131
bar.Set(pb.ReturnSymbol, "")
3232
bar.SetTemplateString("")
@@ -96,8 +96,8 @@ func WithDecompress(decompress bool) Opt {
9696
// WithExpectedDigest is used to validate the downloaded file against the expected digest.
9797
//
9898
// The digest is not verified in the following cases:
99-
// - The digest was not specified.
100-
// - The file already exists in the local target path.
99+
// - The digest was not specified.
100+
// - The file already exists in the local target path.
101101
//
102102
// When the `data` file exists in the cache dir with `<ALGO>.digest` file,
103103
// the digest is verified by comparing the content of `<ALGO>.digest` with the expected
@@ -291,14 +291,14 @@ func Cached(remote string, opts ...Opt) (*Result, error) {
291291
}
292292

293293
// cacheDirectoryPath returns the cache subdirectory path.
294-
// - "url" file contains the url
295-
// - "data" file contains the data
294+
// - "url" file contains the url
295+
// - "data" file contains the data
296296
func cacheDirectoryPath(cacheDir, remote string) string {
297297
return filepath.Join(cacheDir, "download", "by-url-sha256", fmt.Sprintf("%x", sha256.Sum256([]byte(remote))))
298298
}
299299

300300
// cacheDigestPath returns the cache digest file path.
301-
// - "<ALGO>.digest" contains the digest
301+
// - "<ALGO>.digest" contains the digest
302302
func cacheDigestPath(shad string, expectedDigest digest.Digest) (string, error) {
303303
shadDigest := ""
304304
if expectedDigest != "" {
@@ -316,9 +316,9 @@ func IsLocal(s string) bool {
316316
}
317317

318318
// canonicalLocalPath canonicalizes the local path string.
319-
// - Make sure the file has no scheme, or the `file://` scheme
320-
// - If it has the `file://` scheme, strip the scheme and make sure the filename is absolute
321-
// - Expand a leading `~`, or convert relative to absolute name
319+
// - Make sure the file has no scheme, or the `file://` scheme
320+
// - If it has the `file://` scheme, strip the scheme and make sure the filename is absolute
321+
// - Expand a leading `~`, or convert relative to absolute name
322322
func canonicalLocalPath(s string) (string, error) {
323323
if s == "" {
324324
return "", fmt.Errorf("got empty path")

pkg/driver/driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
// Driver interface is used by hostagent for managing vm.
1313
//
1414
// This interface is extended by BaseDriver which provides default implementation.
15-
// All other driver definition must extend BaseDriver
15+
// All other driver definition must extend BaseDriver.
1616
type Driver interface {
1717
// Validate returns error if the current driver isn't support for given config
1818
Validate() error

pkg/guestagent/kubernetesservice/kubernetesservice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
type Protocol string
2323

2424
const (
25-
// UDP/SCTP when lima port forwarding works on those protocols
25+
// UDP/SCTP when lima port forwarding works on those protocols.
2626
TCP Protocol = "TCP"
2727
)
2828

pkg/guestagent/procnettcp/procnettcp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Kind = string
1515
const (
1616
TCP Kind = "tcp"
1717
TCP6 Kind = "tcp6"
18-
// TODO: "udp", "udp6", "udplite", "udplite6"
18+
// TODO: "udp", "udp6", "udplite", "udplite6".
1919
)
2020

2121
type State = int

pkg/guestagent/procnettcp/procnettcp_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"os"
66
)
77

8-
// ParseFiles parses /proc/net/{tcp, tcp6}
8+
// ParseFiles parses /proc/net/{tcp, tcp6}.
99
func ParseFiles() ([]Entry, error) {
1010
var res []Entry
1111
files := map[string]Kind{

pkg/hostagent/api/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func (b *Backend) onError(w http.ResponseWriter, err error, ec int) {
2424
_ = json.NewEncoder(w).Encode(e)
2525
}
2626

27-
// GetInfo is the handler for GET /v1/info
27+
// GetInfo is the handler for GET /v1/info.
2828
func (b *Backend) GetInfo(w http.ResponseWriter, r *http.Request) {
2929
if r.Method != http.MethodGet {
3030
w.WriteHeader(http.StatusMethodNotAllowed)

pkg/hostagent/port_darwin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/sirupsen/logrus"
1515
)
1616

17-
// forwardTCP is not thread-safe
17+
// forwardTCP is not thread-safe.
1818
func forwardTCP(ctx context.Context, sshConfig *ssh.SSHConfig, port int, local, remote, verb string) error {
1919
if strings.HasPrefix(local, "/") {
2020
return forwardSSH(ctx, sshConfig, port, local, remote, verb, false)

pkg/httpclientutil/httpclientutil.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ func readAtMost(r io.Reader, maxBytes int) ([]byte, error) {
6363
return b, nil
6464
}
6565

66-
// HTTPStatusErrorBodyMaxLength specifies the maximum length of HTTPStatusError.Body
66+
// HTTPStatusErrorBodyMaxLength specifies the maximum length of HTTPStatusError.Body.
6767
const HTTPStatusErrorBodyMaxLength = 64 * 1024
6868

69-
// HTTPStatusError is created from non-2XX HTTP response
69+
// HTTPStatusError is created from non-2XX HTTP response.
7070
type HTTPStatusError struct {
7171
// StatusCode is non-2XX status code
7272
StatusCode int

pkg/httputil/httputil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package httputil
22

3-
// ErrorJSON is returned with "application/json" content type and non-2XX status code
3+
// ErrorJSON is returned with "application/json" content type and non-2XX status code.
44
type ErrorJSON struct {
55
Message string `json:"message"`
66
}

pkg/ioutilx/ioutilx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func ReadAtMaximum(r io.Reader, n int64) ([]byte, error) {
2929

3030
// FromUTF16le returns an io.Reader for UTF16le data.
3131
// Windows uses little endian by default, use unicode.UseBOM policy to retrieve BOM from the text,
32-
// and unicode.LittleEndian as a fallback
32+
// and unicode.LittleEndian as a fallback.
3333
func FromUTF16le(r io.Reader) io.Reader {
3434
o := transform.NewReader(r, unicode.UTF16(unicode.LittleEndian, unicode.UseBOM).NewDecoder())
3535
return o

pkg/limayaml/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func defaultContainerdArchives() []File {
8989
}
9090
}
9191

92-
// FirstUsernetIndex gets the index of first usernet network under l.Network[]. Returns -1 if no usernet network found
92+
// FirstUsernetIndex gets the index of first usernet network under l.Network[]. Returns -1 if no usernet network found.
9393
func FirstUsernetIndex(l *LimaYAML) int {
9494
return slices.IndexFunc(l.Networks, func(network Network) bool { return networks.IsUsernet(network.Lima) })
9595
}

pkg/logrusutil/logrusutil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fallback:
5959
entry.Info(header + string(jsonLine))
6060
}
6161

62-
// JSON is the type used in logrus.JSONFormatter
62+
// JSON is the type used in logrus.JSONFormatter.
6363
type JSON struct {
6464
Level string `json:"level"`
6565
Msg string `json:"msg"`

pkg/networks/commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (config *YAML) Check(name string) error {
2525
return fmt.Errorf("network %q is not defined", name)
2626
}
2727

28-
// Usernet Returns true if the mode of given network is ModeUserV2
28+
// Usernet returns true if the mode of given network is ModeUserV2.
2929
func (config *YAML) Usernet(name string) (bool, error) {
3030
if nw, ok := config.Networks[name]; ok {
3131
return nw.Mode == ModeUserV2, nil

pkg/networks/usernet/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func Sock(name string, sockType SockType) (string, error) {
2828
return SockWithDirectory(filepath.Join(dir, name), name, sockType)
2929
}
3030

31-
// SockWithDirectory return a usernet socket based on dir, name and sockType
31+
// SockWithDirectory return a usernet socket based on dir, name and sockType.
3232
func SockWithDirectory(dir, name string, sockType SockType) (string, error) {
3333
if name == "" {
3434
name = "default"
@@ -41,7 +41,7 @@ func SockWithDirectory(dir, name string, sockType SockType) (string, error) {
4141
return sockPath, nil
4242
}
4343

44-
// PIDFile returns a path for usernet PID file
44+
// PIDFile returns a path for usernet PID file.
4545
func PIDFile(name string) (string, error) {
4646
dir, err := dirnames.LimaNetworksDir()
4747
if err != nil {
@@ -84,12 +84,12 @@ func Subnet(name string) (net.IP, error) {
8484
return ipNet.IP, err
8585
}
8686

87-
// GatewayIP returns the 2nd IP for the given subnet
87+
// GatewayIP returns the 2nd IP for the given subnet.
8888
func GatewayIP(subnet net.IP) string {
8989
return cidr.Inc(cidr.Inc(subnet)).String()
9090
}
9191

92-
// DNSIP returns the 3rd IP for the given subnet
92+
// DNSIP returns the 3rd IP for the given subnet.
9393
func DNSIP(subnet net.IP) string {
9494
return cidr.Inc(cidr.Inc(cidr.Inc(subnet))).String()
9595
}

pkg/networks/usernet/recoincile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
)
2121

2222
// Start starts a instance a usernet network with the given name.
23-
// The name parameter must point to a valid network configuration name under <LIMA_HOME>/_config/networks.yaml with `mode: user-v2`
23+
// The name parameter must point to a valid network configuration name under <LIMA_HOME>/_config/networks.yaml with `mode: user-v2`.
2424
func Start(ctx context.Context, name string) error {
2525
logrus.Debugf("Make sure usernet network is started")
2626
networksDir, err := dirnames.LimaNetworksDir()
@@ -120,7 +120,7 @@ func Start(ctx context.Context, name string) error {
120120
}
121121

122122
// Stop stops running instance a usernet network with the given name.
123-
// The name parameter must point to a valid network configuration name under <LIMA_HOME>/_config/networks.yaml with `mode: user-v2`
123+
// The name parameter must point to a valid network configuration name under <LIMA_HOME>/_config/networks.yaml with `mode: user-v2`.
124124
func Stop(ctx context.Context, name string) error {
125125
logrus.Debugf("Make sure usernet network is stopped")
126126
pidFile, err := PIDFile(name)

pkg/osutil/osutil_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
// UnixPathMax is the value of UNIX_PATH_MAX.
99
const UnixPathMax = 108
1010

11-
// Stat is a selection of syscall.Stat_t
11+
// Stat is a selection of syscall.Stat_t.
1212
type Stat struct {
1313
Uid uint32
1414
Gid uint32

pkg/osutil/osutil_others.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
// UnixPathMax is the value of UNIX_PATH_MAX.
1111
const UnixPathMax = 104
1212

13-
// Stat is a selection of syscall.Stat_t
13+
// Stat is a selection of syscall.Stat_t.
1414
type Stat struct {
1515
Uid uint32
1616
Gid uint32

pkg/qemu/imgutil/imgutil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type InfoFormatSpecificDataVmdkExtent struct {
6464
ClusterSize int `json:"cluster-size,omitempty"` // since QEMU 1.7
6565
}
6666

67-
// Info corresponds to the output of `qemu-img info --output=json FILE`
67+
// Info corresponds to the output of `qemu-img info --output=json FILE`.
6868
type Info struct {
6969
Filename string `json:"filename,omitempty"` // since QEMU 1.3
7070
Format string `json:"format,omitempty"` // since QEMU 1.3

pkg/qemu/qemu.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ type Config struct {
4343
SSHLocalPort int
4444
}
4545

46-
// MinimumQemuVersion is the minimum supported QEMU version
46+
// MinimumQemuVersion is the minimum supported QEMU version.
4747
const (
4848
MinimumQemuVersion = "4.0.0"
4949
)
5050

51-
// EnsureDisk also ensures the kernel and the initrd
51+
// EnsureDisk also ensures the kernel and the initrd.
5252
func EnsureDisk(ctx context.Context, cfg Config) error {
5353
diffDisk := filepath.Join(cfg.InstanceDir, filenames.DiffDisk)
5454
if _, err := os.Stat(diffDisk); err == nil || !errors.Is(err, os.ErrNotExist) {
@@ -227,7 +227,7 @@ func Load(cfg Config, run bool, tag string) error {
227227
return err
228228
}
229229

230-
// List returns a space-separated list of all snapshots, with header and newlines
230+
// List returns a space-separated list of all snapshots, with header and newlines.
231231
func List(cfg Config, run bool) (string, error) {
232232
if run {
233233
out, err := sendHmpCommand(cfg, "info", "snapshots")
@@ -455,7 +455,7 @@ func adjustMemBytesDarwinARM64HVF(memBytes int64, accel string, features *featur
455455
return memBytes
456456
}
457457

458-
// qemuMachine returns string to use for -machine
458+
// qemuMachine returns string to use for -machine.
459459
func qemuMachine(arch limayaml.Arch) string {
460460
if arch == limayaml.X8664 {
461461
return "q35"
@@ -1004,7 +1004,7 @@ func VirtiofsdCmdline(cfg Config, mountIndex int) ([]string, error) {
10041004
}, nil
10051005
}
10061006

1007-
// qemuArch returns the arch string used by qemu
1007+
// qemuArch returns the arch string used by qemu.
10081008
func qemuArch(arch limayaml.Arch) string {
10091009
if arch == limayaml.ARMV7L {
10101010
return "arm"

0 commit comments

Comments
 (0)