240406.1 · f3655c0d4b7320ae6991581e7d5942dcf67552e1
all: reconcile build tags with internal/dirent package and test builds
This mostly fixes the cluster fuck of build directives and reconciles them to match the Unix platforms supported by internal/dirent + darwin it also removes the appengine crap that was a legacy of the original code.
reading declarations
@@ -24,3 +24,5 @@ jobs: run: go test ./... - name: Test Race run: go test -race ./...+ - name: Test Builds+ run: make test_build
@@ -18,6 +18,10 @@ test_build_linux_amd64: test_build_windows_amd64: GOOS=windows GOARCH=amd64 go test -c -o /dev/null +.PHONY: test_build_windows_arm64+test_build_windows_arm64:+ GOOS=windows GOARCH=arm64 go test -c -o /dev/null+ .PHONY: test_build_freebsd_amd64 test_build_freebsd_amd64: GOOS=freebsd GOARCH=amd64 go test -c -o /dev/null@@ -30,12 +34,45 @@ test_build_openbsd_amd64: test_build_netbsd_amd64: GOOS=netbsd GOARCH=amd64 go test -c -o /dev/null +.PHONY: test_build_dragonfly_amd64+test_build_dragonfly_amd64:+ GOOS=dragonfly GOARCH=amd64 go test -c -o /dev/null++.PHONY: test_build_solaris_amd64+test_build_solaris_amd64:+ GOOS=solaris GOARCH=amd64 go test -c -o /dev/null++.PHONY: test_build_wasip1_wasm+test_build_wasip1_wasm:+ GOOS=wasip1 GOARCH=wasm go test -c -o /dev/null++.PHONY: test_build_aix_ppc64+test_build_aix_ppc64:+ GOOS=aix GOARCH=ppc64 go test -c -o /dev/null++.PHONY: test_build_js_wasm+test_build_js_wasm:+ GOOS=js GOARCH=wasm go test -c -o /dev/null++# TODO: clean this up and add all supported targets+# # Test that we can build fastwalk on multiple platforms .PHONY: test_build-test_build: test_build_darwin_arm64 test_build_darwin_amd64 \- test_build_linux_arm64 test_build_linux_amd64 \- test_build_windows_amd64 test_build_freebsd_amd64 \- test_build_openbsd_amd64 test_build_netbsd_amd64+test_build: \+ test_build_aix_ppc64 \+ test_build_darwin_amd64 \+ test_build_darwin_arm64 \+ test_build_dragonfly_amd64 \+ test_build_freebsd_amd64 \+ test_build_js_wasm \+ test_build_linux_amd64 \+ test_build_linux_arm64 \+ test_build_netbsd_amd64 \+ test_build_openbsd_amd64 \+ test_build_solaris_amd64 \+ test_build_wasip1_wasm \+ test_build_windows_amd64 \+ test_build_windows_arm64 .PHONY: test test: # runs all tests against the package with race detection and coverage percentage
@@ -1,5 +1,4 @@-//go:build appengine || solaris || (!linux && !darwin && !freebsd && !openbsd && !netbsd)-// +build appengine solaris !linux,!darwin,!freebsd,!openbsd,!netbsd+//go:build !darwin && !(aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris) package fastwalk
@@ -1,6 +1,4 @@-//go:build (linux || darwin || freebsd || openbsd || netbsd) && !appengine-// +build linux darwin freebsd openbsd netbsd-// +build !appengine+//go:build darwin || aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris package fastwalk_test
@@ -1,7 +1,4 @@-//go:build (aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd) && !appengine && !solaris-// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd-// +build !appengine-// +build !solaris+//go:build darwin || aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris package fastwalk
@@ -1,6 +1,4 @@-//go:build (aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris) && !appengine-// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris-// +build !appengine+//go:build aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris package fastwalk
@@ -1,5 +1,4 @@-//go:build appengine || (!linux && !darwin && !freebsd && !openbsd && !netbsd && !windows && !solaris)-// +build appengine !linux,!darwin,!freebsd,!openbsd,!netbsd,!windows,!solaris+//go:build !darwin && !windows && !(aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris) package fastwalk
@@ -1,6 +1,4 @@-//go:build (linux || darwin || freebsd || openbsd || netbsd || !windows) && !appengine-// +build linux darwin freebsd openbsd netbsd !windows-// +build !appengine+//go:build darwin || aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris package fastwalk
@@ -1,6 +1,4 @@-//go:build (linux || darwin || freebsd || openbsd || netbsd || !windows) && !appengine-// +build linux darwin freebsd openbsd netbsd !windows-// +build !appengine+//go:build darwin || aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris package fastwalk
@@ -1,5 +1,4 @@-//go:build windows && !appengine-// +build windows,!appengine+//go:build windows package fastwalk
fastwalk_darwin_test.go
@@ -1,5 +1,4 @@-//go:build darwin && go1.13 && !appengine-// +build darwin,go1.13,!appengine+//go:build darwin && go1.13 package fastwalk
fastwalk_getdirentries_darwin.go
@@ -1,5 +1,4 @@-//go:build darwin && go1.13 && !appengine && !nogetdirentries-// +build darwin,go1.13,!appengine,!nogetdirentries+//go:build darwin && go1.13 && !nogetdirentries package fastwalk
fastwalk_nogetdirentries_darwin.go
@@ -1,5 +1,4 @@-//go:build darwin && go1.13 && !appengine && nogetdirentries-// +build darwin,go1.13,!appengine,nogetdirentries+//go:build darwin && go1.13 && nogetdirentries package fastwalk
@@ -1,5 +1,4 @@-//go:build appengine || solaris || (!linux && !darwin && !freebsd && !openbsd && !netbsd)-// +build appengine solaris !linux,!darwin,!freebsd,!openbsd,!netbsd+//go:build !darwin && !(aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris) package fastwalk
@@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (linux || freebsd || openbsd || netbsd) && !appengine-// +build linux freebsd openbsd netbsd-// +build !appengine+//go:build aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris package fastwalk
@@ -1,4 +1,4 @@-//go:build aix || dragonfly || freebsd || (js && wasm) || wasip1 || linux || netbsd || openbsd || solaris+//go:build aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris package dirent
internal/dirent/dirent_wasip1.go
@@ -1,53 +0,0 @@-// Copyright 2023 The Go Authors. All rights reserved.-// Use of this source code is governed by a BSD-style-// license that can be found in the LICENSE file.--//go:build wasip1--package dirent--import (- "os"- "syscall"- "unsafe"-)--// https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#-dirent-record-const sizeOfDirent = 24--func direntIno(buf []byte) (uint64, bool) {- return readInt(buf, unsafe.Offsetof(syscall.Dirent{}.Ino), unsafe.Sizeof(syscall.Dirent{}.Ino))-}--func direntReclen(buf []byte) (uint64, bool) {- namelen, ok := direntNamlen(buf)- return sizeOfDirent + namelen, ok-}--func direntNamlen(buf []byte) (uint64, bool) {- return readInt(buf, unsafe.Offsetof(syscall.Dirent{}.Namlen), unsafe.Sizeof(syscall.Dirent{}.Namlen))-}--func direntType(buf []byte) os.FileMode {- off := unsafe.Offsetof(syscall.Dirent{}.Type)- if off >= uintptr(len(buf)) {- return ^os.FileMode(0) // unknown- }- switch syscall.Filetype(buf[off]) {- case syscall.FILETYPE_BLOCK_DEVICE:- return os.ModeDevice- case syscall.FILETYPE_CHARACTER_DEVICE:- return os.ModeDevice | os.ModeCharDevice- case syscall.FILETYPE_DIRECTORY:- return os.ModeDir- case syscall.FILETYPE_REGULAR_FILE:- return 0- case syscall.FILETYPE_SOCKET_DGRAM:- return os.ModeSocket- case syscall.FILETYPE_SOCKET_STREAM:- return os.ModeSocket- case syscall.FILETYPE_SYMBOLIC_LINK:- return os.ModeSymlink- }- return ^os.FileMode(0) // unknown-}