fixed warnings

This commit is contained in:
Martino Ferrari
2026-01-20 00:22:33 +01:00
parent b7c8b8a056
commit aa47a3c4fd

View File

@@ -3,7 +3,6 @@ package main
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"github.com/marte-dev/marte-dev-tools/internal/builder" "github.com/marte-dev/marte-dev-tools/internal/builder"
@@ -48,15 +47,18 @@ func runBuild(args []string) {
} }
outputDir := "build" outputDir := "build"
os.MkdirAll(outputDir, 0755) if err := os.MkdirAll(outputDir, 0755); err != nil {
fmt.Printf("Build failed: %v\n", err)
os.Exit(1)
} else {
b := builder.NewBuilder(args) b := builder.NewBuilder(args)
err := b.Build(outputDir) err = b.Build(outputDir)
if err != nil { if err != nil {
fmt.Printf("Build failed: %v\n", err) fmt.Printf("Build failed: %v\n", err)
os.Exit(1) os.Exit(1)
} }
fmt.Println("Build successful. Output in", outputDir) fmt.Println("Build successful. Output in", outputDir)
}
} }
func runCheck(args []string) { func runCheck(args []string) {
@@ -69,7 +71,7 @@ func runCheck(args []string) {
// configs := make(map[string]*parser.Configuration) // We don't strictly need this map if we just build the tree // configs := make(map[string]*parser.Configuration) // We don't strictly need this map if we just build the tree
for _, file := range args { for _, file := range args {
content, err := ioutil.ReadFile(file) content, err := os.ReadFile(file)
if err != nil { if err != nil {
fmt.Printf("Error reading %s: %v\n", file, err) fmt.Printf("Error reading %s: %v\n", file, err)
continue continue
@@ -115,7 +117,7 @@ func runFmt(args []string) {
} }
for _, file := range args { for _, file := range args {
content, err := ioutil.ReadFile(file) content, err := os.ReadFile(file)
if err != nil { if err != nil {
fmt.Printf("Error reading %s: %v\n", file, err) fmt.Printf("Error reading %s: %v\n", file, err)
continue continue
@@ -131,7 +133,7 @@ func runFmt(args []string) {
var buf bytes.Buffer var buf bytes.Buffer
formatter.Format(config, &buf) formatter.Format(config, &buf)
err = ioutil.WriteFile(file, buf.Bytes(), 0644) err = os.WriteFile(file, buf.Bytes(), 0644)
if err != nil { if err != nil {
fmt.Printf("Error writing %s: %v\n", file, err) fmt.Printf("Error writing %s: %v\n", file, err)
continue continue