Files
psycep c3173c535a tools: add build-tag stubs for Windows and CGO_ENABLED=0 builds
Enables clean builds under GOOS=windows CGO_ENABLED=0 and under
CGO_ENABLED=0 on Linux. The three tools that can't be built in those
configurations now substitute a stub that prints a clear message
and exits 1, so go build ./... succeeds across all target platforms.

- tools/sniff: tagged !windows && cgo (needs libpcap via cgo).
  Stub (main_stub.go) covers windows || !cgo.
- tools/split: same tags as sniff (also pcap).
- tools/sniffer: tagged !windows (uses Unix raw sockets directly via
  syscall, not cgo). Stub (main_windows.go) covers Windows.

Verified:
- go build ./... clean (default, cgo=1 Linux)
- CGO_ENABLED=0 go build ./... clean (portable Linux)
- GOOS=windows CGO_ENABLED=0 go build ./... clean (Windows)
- go vet clean across all three configurations
- All 13 pkg/transport tests pass under CGO_ENABLED=0, confirming
  direct_portable.go's directDial path is correct.
2026-04-22 10:46:38 -05:00

28 lines
809 B
Go

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build windows || !cgo
package main
import (
"fmt"
"os"
)
func main() {
fmt.Fprintln(os.Stderr, "split: not built. This tool needs libpcap via cgo; rebuild with CGO_ENABLED=1 on Linux or macOS.")
os.Exit(1)
}