fix(build): go and nix builds not working properly
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"snitch/internal/testutil"
|
"github.com/karol-broda/snitch/internal/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestCLIContract tests the CLI interface contracts as specified in the README
|
// TestCLIContract tests the CLI interface contracts as specified in the README
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"snitch/internal/testutil"
|
"github.com/karol-broda/snitch/internal/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
var updateGolden = flag.Bool("update-golden", false, "Update golden files")
|
var updateGolden = flag.Bool("update-golden", false, "Update golden files")
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"snitch/internal/color"
|
"github.com/karol-broda/snitch/internal/color"
|
||||||
"snitch/internal/config"
|
"github.com/karol-broda/snitch/internal/config"
|
||||||
"snitch/internal/resolver"
|
"github.com/karol-broda/snitch/internal/resolver"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"snitch/internal/testutil"
|
"github.com/karol-broda/snitch/internal/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLsCommand_EmptyResults(t *testing.T) {
|
func TestLsCommand_EmptyResults(t *testing.T) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"snitch/internal/config"
|
"github.com/karol-broda/snitch/internal/config"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"snitch/internal/color"
|
"github.com/karol-broda/snitch/internal/color"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"snitch/internal/config"
|
"github.com/karol-broda/snitch/internal/config"
|
||||||
"snitch/internal/tui"
|
"github.com/karol-broda/snitch/internal/tui"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"snitch/internal/resolver"
|
"github.com/karol-broda/snitch/internal/resolver"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"snitch/internal/tui"
|
"github.com/karol-broda/snitch/internal/tui"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -50,13 +50,15 @@
|
|||||||
version = "nix-${rev}";
|
version = "nix-${rev}";
|
||||||
go = mkGo125 pkgs;
|
go = mkGo125 pkgs;
|
||||||
buildGoModule = pkgs.buildGoModule.override { inherit go; };
|
buildGoModule = pkgs.buildGoModule.override { inherit go; };
|
||||||
|
isDarwin = pkgs.stdenv.isDarwin;
|
||||||
in
|
in
|
||||||
buildGoModule {
|
buildGoModule {
|
||||||
pname = "snitch";
|
pname = "snitch";
|
||||||
inherit version;
|
inherit version;
|
||||||
src = self;
|
src = self;
|
||||||
vendorHash = "sha256-fX3wOqeOgjH7AuWGxPQxJ+wbhp240CW8tiF4rVUUDzk=";
|
vendorHash = "sha256-fX3wOqeOgjH7AuWGxPQxJ+wbhp240CW8tiF4rVUUDzk=";
|
||||||
env.CGO_ENABLED = "0";
|
# darwin requires cgo for libproc, linux uses pure go with /proc
|
||||||
|
env.CGO_ENABLED = if isDarwin then "1" else "0";
|
||||||
env.GOTOOLCHAIN = "local";
|
env.GOTOOLCHAIN = "local";
|
||||||
ldflags = [
|
ldflags = [
|
||||||
"-s"
|
"-s"
|
||||||
@@ -69,7 +71,7 @@
|
|||||||
description = "a friendlier ss/netstat for humans";
|
description = "a friendlier ss/netstat for humans";
|
||||||
homepage = "https://github.com/karol-broda/snitch";
|
homepage = "https://github.com/karol-broda/snitch";
|
||||||
license = pkgs.lib.licenses.mit;
|
license = pkgs.lib.licenses.mit;
|
||||||
platforms = pkgs.lib.platforms.linux;
|
platforms = pkgs.lib.platforms.linux ++ pkgs.lib.platforms.darwin;
|
||||||
mainProgram = "snitch";
|
mainProgram = "snitch";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module snitch
|
module github.com/karol-broda/snitch
|
||||||
|
|
||||||
go 1.24.0
|
go 1.24.0
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestCollector wraps MockCollector for use in tests
|
// TestCollector wraps MockCollector for use in tests
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package tui
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package tui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package tui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package tui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"snitch/internal/theme"
|
"github.com/karol-broda/snitch/internal/theme"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package tui
|
package tui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package tui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"snitch/internal/collector"
|
"github.com/karol-broda/snitch/internal/collector"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user