about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-01-21 13:29:31 -0800
committerFranck Cuny <franck@fcuny.net>2024-01-21 13:29:31 -0800
commit885789b796d234afeb5e1f3343004761ab6c3376 (patch)
treefd91d6d2f57cbeada57d672f3381b1f45699e4fe
parentadd gomod to dependabot (diff)
downloadworld-885789b796d234afeb5e1f3343004761ab6c3376.tar.gz
fix linter issues
Diffstat (limited to '')
-rw-r--r--tools/music-organizer/main.go26
-rw-r--r--tools/schedlatency/main.go1
2 files changed, 12 insertions, 15 deletions
diff --git a/tools/music-organizer/main.go b/tools/music-organizer/main.go
index 30baa26..253afef 100644
--- a/tools/music-organizer/main.go
+++ b/tools/music-organizer/main.go
@@ -23,9 +23,7 @@ const (
 	TrackTitleMaxLenght = 255 - 3 - 4
 )
 
-var (
-	musicDest = flag.String("dest", fmt.Sprintf("%s/media/music", os.Getenv("HOME")), "where to store the music")
-)
+var musicDest = flag.String("dest", fmt.Sprintf("%s/media/music", os.Getenv("HOME")), "where to store the music")
 
 // replace slashes with dashes
 func stripSlash(s string) string {
@@ -34,7 +32,8 @@ func stripSlash(s string) string {
 
 // return the name of the artist, album and the title of the track
 // the title of the track has the following format:
-//     {track #} {track title}.{track format}
+//
+//	{track #} {track title}.{track format}
 func generatePath(m tag.Metadata) (string, string, string) {
 	var artist, album, title string
 	var track int
@@ -69,7 +68,7 @@ func generatePath(m tag.Metadata) (string, string, string) {
 
 // create all the required directories.  if we fail to create one, we die
 func makeParents(path string) error {
-	if err := os.MkdirAll(path, 0777); err != nil {
+	if err := os.MkdirAll(path, 0o777); err != nil {
 		return fmt.Errorf("failed to create %s: %v", path, err)
 	}
 	return nil
@@ -99,7 +98,7 @@ func makeCopy(src, dst string) error {
 	}
 	defer f.Close()
 
-	t, err := os.OpenFile(dst, os.O_RDWR|os.O_CREATE, 0666)
+	t, err := os.OpenFile(dst, os.O_RDWR|os.O_CREATE, 0o666)
 	if err != nil {
 		return err
 	}
@@ -115,14 +114,13 @@ func makeCopy(src, dst string) error {
 
 // ensure the file is named correctly and is moved to the correct destination
 // before we can do that, we need to:
-// 1. check if the track already exists, if it does, does it have the same md5 ?
-//    if they are similar, we skip them.  if they are not, we log and don't do
-//    anything
-// 2. we can move the file to the destination
-// 3. we can delete the original file
+//  1. check if the track already exists, if it does, does it have the same md5 ?
+//     if they are similar, we skip them.  if they are not, we log and don't do
+//     anything
+//  2. we can move the file to the destination
+//  3. we can delete the original file
 func renameFile(originalPath string, artist, album, title string) error {
-
-	var directories = filepath.Join(*musicDest, artist, album)
+	directories := filepath.Join(*musicDest, artist, album)
 	destination := filepath.Join(directories, title)
 
 	// check if the file is present
@@ -263,7 +261,7 @@ func main() {
 	}
 
 	for _, d := range paths {
-		//XXX deal with filenames that are too long
+		// XXX deal with filenames that are too long
 		// scan the directory and try to find any file that we want to move
 		err := filepath.Walk(d, processPath)
 		if err != nil {
diff --git a/tools/schedlatency/main.go b/tools/schedlatency/main.go
index 0522026..7dd709e 100644
--- a/tools/schedlatency/main.go
+++ b/tools/schedlatency/main.go
@@ -138,7 +138,6 @@ type Proc struct {
 // 1. time spent on the cpu
 // 2. time spent waiting on a runqueue
 // 3. # of timeslices run on this cpu
-//
 func (p Proc) SchedStat() (ProcSchedStat, error) {
 	path := fmt.Sprintf("/proc/%d/schedstat", p.PID)
 	b, err := ioutil.ReadFile(path)