| Server IP : 217.160.0.212 / Your IP : 216.73.216.141 Web Server : Apache System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64 User : sws1073854427 ( 1073854427) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/lib/go/src/cmd/go/testdata/script/ |
Upload File : |
[!GOOS:windows] skip
go run .
stdout 'ws2_32.dll: not found'
go run -tags net .
stdout 'ws2_32.dll: found'
-- go.mod --
module m
go 1.21
-- utils.go --
package main
import (
"fmt"
"syscall"
"unsafe"
)
func hasModuleHandle() {
const ws2_32 = "ws2_32.dll"
getModuleHandle := syscall.MustLoadDLL("kernel32.dll").MustFindProc("GetModuleHandleW")
mod, _, _ := getModuleHandle.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(ws2_32))))
if mod != 0 {
fmt.Println(ws2_32+":", "found")
} else {
fmt.Println(ws2_32+":", "not found")
}
}
-- net.go --
//go:build net
package main
import _ "net"
func main() {
hasModuleHandle()
}
-- nonet.go --
//go:build !net
package main
func main() {
hasModuleHandle()
}