I am trying to create a Golang server using the gin framework on ubuntu. It works fine when it is executed in the terminal after building it with go build and equally works well locally. Systemd I got this error Answer Adding a working directory to the systemd fix this error.
Tag: go
How to specify x509 certificate for Azure SDK in Golang
I am trying to connect to use the Azure SDK for Golang to download files from a container online to my device and am using the connection string provided from azure to connect. For context this is running on a version of embedded Linux I have two questions, first how do I pass a specific certificate to the azure SDK
Go pipe write end being closed, why?
I just read some Go code that does something along the following lines: some_binary is a long running process. Why is inst.wpipe closed and set to nil? What would happen if its not closed? Is it common/necessary to close inst.wpipe? Is dup2(pipe_fd[1], 1) the C analogue of cmd.Stdout = inst.wpipe; inst.wpipe.Close()? Answer That code is typical of a program that
Contents of large file getting corrupted while reading records sequentially
I have a file, with around 85 million json records. The file size is around 110 Gb. I want to read from this file in batches of 1 million (in sequence). I am trying to read from this file line by line using a scanner, and appending these 1 million records. Here is the code gist of what I am
Changing linux user password from Golang not working
I need a one-liner from inside a go routine to change a user’s password in linux. The command that WORKS from the command line: But this doesn’t work from my Go program. I have tried substituting other one-liner commands, such as: drm file.txt, touch file.txt, etc. And those all work. The Go program is in a package inside a big
Failed to install
I was trying to install gospider and other tools,I get this error I tried to update sudo go get -u all as in here but it runs forever. Answer If strings.ReplaceAll is undefined that means you’re using a version of Go prior to 1.12, which is when that function was added. To install that package, you need to first update
Why is this twurl command (run on linux, by golang exec) not being authenticated?
I’m currently working on a Golang website (running on Ubuntu) that will update a twitter status. I used twurl customer key authentication on the system and I can successfully update the status if I type directly into the linux terminal. For example ssh/putty into target system type in terminal: twurl -d ‘status=is this thing on’ /1.1/statuses/update.json twitter status successfully updated
How to get Resident Set Size (RSS)
I need to know physical memory consumption of my Go process in Linux. What I need is Resident Set Size (RSS). runtime.ReadMemStats is not suitable because there is no way to get a size of a portion of a virtual memory that is resident. syscall.Getrusage is not suitable because it returns only Maxrss that is maximal RSS during process life.
How to gracefully shutdown a Go service running on Kubernetes
I have an API written in Go that has been Dockerised and runs in a Kubernetes cluster on GKE. At the moment my API server does not handle any shutdown scenarios such as a Pod dying or being purposefully brought down. What set of UNIX signals should I expect to trap to gracefully shutdown the server and what circumstances would
Slicing in Golang leads to blank terminal and messed up threads
Hey I am trying to automate a tool to do my recon I am using url to store url with https:// but there’s a tool whois and sublist3r that needs the address without https:// so I sliced the string but when I run the tool it crashes out and blanks out my terminal I can type but can’t see the