Issue I am trying to specify the windows location for the .kube/config file for the Go client application without specifying the absolute path. kubeconfig := flag.String("kubeconfig", "%USERPROFILE%/.kube/config", "location to the Kube config file") Output : panic: runtime error: invalid memory
Continue readingTag: windows
Check if Windows file is redirected to itself
Issue I’m trying to figure out how I can test if a file is being redirected to itself, e.g. .\command.exe file1 > file1 In the *nix world, I’d just use something like this: // Language agnostic… if (file_dev == out_dev
Continue readingGolang: call Windows DLL functions
Issue I am writing a Go app that calls into a Windows DLL. The DLL was written with MSVC and has extern “C” exports using __declspec(dllexport). The top of my Go app is as follows: //#cgo CFLAGS: -IC:/Repos/Module/include //#cgo LDFLAGS:
Continue readingHow can I save the HICON as file in Go
Issue I can get the HICON with ExtractIconW for example: package main import ( "log" "syscall" "unsafe" ) func MakeIntResource(id uintptr) *uint16 { return (*uint16)(unsafe.Pointer(id)) } const IDI_QUESTION = 32514 func main() { user32Dll := syscall.NewLazyDLL("User32.dll") procLoadIconW := user32Dll.NewProc("LoadIconW") hIcon,
Continue readingUsing 256 colors in Go
Issue How Can I used 256 colors in terminal with Golang. As Libraries like faith/color only have limited colors support. This python library here use some kind of default code and a color code to print colored text in terminal.
Continue readingHow to fix ‘–go_out: protoc-gen-go: The system cannot find the file specified.’ error
Issue I Create a person.proto and I wanna compile this file to *.go . I installed Package go get -u github.com/golang/protobuf/protoc-gen-go After executing the following command .\protoc.exe –go_out=. person.proto I get the error below –go_out: protoc-gen-go: The system cannot find
Continue readingGorm Association Delete does not remove rows, instead update rows
Issue A client has many TenantRoles. I want to delete all TenantRoles once a client is deleted. type Client struct { Id string `gorm:"primaryKey"` CreatedAt time.Time UpdatedAt time.Time TenantRoles []roles.TenantRole } type TenantRole struct { Id uint `gorm:"primarykey"` CreatedAt time.Time
Continue readingGo lang access denied
Issue I’m new to the GO programming language, what I’m trying to do is to put some items into the map and then remove one of them, when I’m trying to remove one of the items from array I’m getting
Continue readingEnumerating Registry Values in Go (Golang)
Issue I’m trying to enumerate over a list of values in the Windows registry using Go, but I’m running into some trouble. I’ve tried two approaches: using both the Go-provided syscall library to call into RegEnumValue, as well as using
Continue readingHow to detect Hidden Files in a folder in Go – cross-platform approach
Issue I’m iterating through a mounted folder via filePath.Walk method in golang, but it returns the hidden files as well. I have to skip those hidden files. For MaxOS and Linux, we can detect hidden file via .prefix in the
Continue reading