Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

2 votes
1 answers
2558 views
Crosscompile go(lang) app with docker for alpine linux (musl) aarch64 with native libs so CGO enabled
## Background I'm writing an open-source GTK go app subsonic API client which: - targets on first place mobile friendly Linux like [postmarketOS][1] (alpine linux), [Mobian][2] (debian) - in future will be also extended to desktop Linux, Windows and Mac OS but not Android or iOS as they already have...
## Background I'm writing an open-source GTK go app subsonic API client which: - targets on first place mobile friendly Linux like postmarketOS (alpine linux), Mobian (debian) - in future will be also extended to desktop Linux, Windows and Mac OS but not Android or iOS as they already have one. - needs to be available at least on aarch64 and x86_64 - depends on native libs like portaudio, libasound, libopus - so it needs CGO to be enabled I haven't published app yet as I self-host my git and I have to do some additional config. It won't be available until late october 2021. App successfully compiles (on host) and runs on my main PC which is x86_64 fedora. App successfully compiles (on docker) and runs on aarch64 **glibc** distros like Mobian This is Dockerfile:
`
FROM golang:1.17-bullseye
LABEL os=linux
LABEL arch=arm64
ENV GOOS=linux
ENV GOARCH=arm64
ENV CGO_ENABLED=1
ENV CC=aarch64-linux-gnu-gcc
ENV PATH="/go/bin/${GOOS}_${GOARCH}:${PATH}"
ENV PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig
# install build & runtime dependencies
RUN dpkg --add-architecture arm64 
RUN apt update && apt upgrade -y 
RUN apt install -y --no-install-recommends \
        protobuf-compiler \
        upx \
        gcc-aarch64-linux-gnu \
        libc6-dev-arm64-cross \
        pkg-config \
        libasound2-dev:arm64 \
    	libgtk-3-dev:arm64 \
    	libcairo2-dev:arm64 \
    	libglib2.0-dev:arm64 \
    	libgdk-pixbuf2.0-dev:arm64 \
        libsamplerate0:arm64 \
        libsamplerate0-dev:arm64 \
        libopusfile0:arm64 \
        libopusfile-dev:arm64 \
        libopus0:arm64 \
        libopus-dev:arm64 \
        libportaudio2:arm64 \
        portaudio19-dev:arm64 
# install build dependencies (code generators)
RUN go get github.com/hajimehoshi/oto \
    && go get github.com/faiface/beep \
    && go get github.com/faiface/beep/flac \
    && go get github.com/faiface/beep/speaker \
    && go get github.com/faiface/beep/mp3 \
    && go get github.com/faiface/beep/vorbis \
    && go get github.com/faiface/beep/wav\
    && go get github.com/gotk3/gotk3 \
    && go get github.com/delucks/go-subsonic \
    && go get github.com/hashicorp/go-retryablehttp \
    && go get github.com/zalando/go-keyring \
    && go get github.com/emirpasic/gods/lists/ \
    && go get github.com/emirpasic/gods/lists/arraylist \
` ## Problems 1. I can't run Mobian working binary on postmarketOS as alpine linux uses musl instead. file output is: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, (...) for GNU/Linux 3.7.0. not stripped. 2. I haven't manged to use musl toolchain in docker debian as it is 32 binary executable and image is 64 bit. 3. I couldn't find anything about multiarch in alpine so probably I can't use docker image goalng:1.17-alpine on x86_64 (I'd have also to find native libs packaged) I wish it's just problem with my config, if it's possible I'd love solution with docker as I'd like to use CI/CD in future. ## Resources, ideas, workarounds - I have raspberry pi with debian installed with some services. I could use with native musl toolchain and debian aarch64 docker container but it's not handy in production pipeline. Also, I haven't tried this. ## Good to read 1. Crosscompile CGO projects (also with docker) 2. Crosscompile with cross-platform musl toolchains 3. Related stackoverflow thread about alpine linux and go binaries
BigB (21 rep)
Aug 27, 2021, 09:27 PM • Last activity: May 10, 2025, 10:03 PM
0 votes
1 answers
2661 views
couldn't import golang modules
I have a problem with importing a module `github.com/lib/pq` in GoLang. I'm using Garuda Linux and I think Garuda is setting go environments differently than windows or Ubuntu. I installed using pacman, not from the official site. So, I checked my go environment variables `$GOROOT` and `$GOPATH` whi...
I have a problem with importing a module github.com/lib/pq in GoLang. I'm using Garuda Linux and I think Garuda is setting go environments differently than windows or Ubuntu. I installed using pacman, not from the official site. So, I checked my go environment variables $GOROOT and $GOPATH which was by default set by the Linux distro. Then, I installed postgres driver using go get -u github.com/lib/pq as well as tried with GO111MODULE=on go get github.com/lib/pq. The installed got stored in the pkg folder rather than src folder. After importing the package, I am getting this error: database.go:6:2: no required module provides package github.com/lib/pq: working directory is not part of a module I tried by setting $GOBIN=$GOPATH/bin but still the same error. Is it because of my system configuration or go environments, I couldn't figure it out yet. So, any fix to the error?
Satyaban Sahoo (1 rep)
Feb 24, 2021, 04:21 PM • Last activity: Apr 30, 2025, 06:06 PM
3 votes
2 answers
1205 views
How to run `go run` against inline code
I have this mini bash script #!/usr/bin/env bash go run package /dev/fd/63: import "/dev/fd/63": cannot import absolute path
I have this mini bash script #!/usr/bin/env bash go run package /dev/fd/63: import "/dev/fd/63": cannot import absolute path
Alexander Mills (10734 rep)
Feb 6, 2020, 03:43 AM • Last activity: Feb 24, 2025, 02:13 PM
1 votes
2 answers
104 views
Why does the kill command not work for SIGTSTP, but works for some other signals (SIGSTOP/SIGINT etc.)?
I have the following two simple programs. Parent: ```go package main import ( "fmt" "syscall" ) func main() { attr := &syscall.ProcAttr{ Files: []uintptr{0, 1, 2}, Sys: &syscall.SysProcAttr{ // child in its own group Setpgid: true, Pgid: 0, }, } _, err := syscall.ForkExec("./child/child", []string{"...
I have the following two simple programs. Parent:
package main

import (
	"fmt"
	"syscall"
)

func main() {
	attr := &syscall.ProcAttr{
		Files: []uintptr{0, 1, 2},
		Sys: &syscall.SysProcAttr{ // child in its own group
			Setpgid: true,
			Pgid:    0,
		},
	}

	_, err := syscall.ForkExec("./child/child", []string{"child"}, attr)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}
}
Child:
package main

import (
	"fmt"
	"time"
)

func main() {
	for {
		fmt.Println("hi from child")
		time.Sleep(time.Second * 5)
	}
}
Output of the ps: yakog@yakog-computer:~/goprojects/parent$ ps -o pid,ppid,pgid,uid,wchan,stat,tt,command -t /dev/pts/19 PID PPID PGID UID WCHAN STAT TT COMMAND 1867701 1867320 1867701 1000 do_sel Ss+ pts/19 bash 1870508 2118 1870508 1000 ep_pol Sl pts/19 child When I press CTRL-Z or CTRL-C, it doesn't have any effect. That's exactly what I expect since the process 1870508 is not part of the foreground job and CTRL-Z/CTRL-C invokes kill -SIGTSTP -1867701/kill -SIGINT -1867701. Thus, 1870508 doesn't receive these signals. Also, when I invoke kill -SIGINT 1870508 or kill -SIGSTOP 1870508, the process is terminated/suspended. I still can understand it. Although 1870508 is not part of the foreground job, with kill command **we "directly" send the signal to the process**. However, why does kill -SIGTSTP 1870508 not work? After starting the ./parent process and calling kill -SIGTSTP 1870508 command, literally nothing happens (the 1870508 still has status R/S and continues to print to the terminal). I can't understand why it didn't suspend the process (moved it to T). It's should be same as with -SIGINT and -SIGSTOP (**we "directly" send -SIGTSTP to the process**), however, it has not effect in this case. What is strange is that if we change parent code (code below) and make it continues the execution after the child is created, then kill -SIGTSTP 1870508 works as it should (child is suspended).
package main

import (
	"fmt"
	"os/signal"
	"syscall"
	"time"
)

func main() {
	attr := &syscall.ProcAttr{
		Files: []uintptr{0, 1, 2},
		Sys: &syscall.SysProcAttr{ // child in its own group
			Setpgid: true,
			Pgid:    0,
		},
	}

	_, err := syscall.ForkExec("./child/child", []string{"child"}, attr)
	signal.Ignore(syscall.SIGTSTP)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}

	for {
		fmt.Println("hi from parent")
		time.Sleep(time.Second * 7)
	}
}
---- Additionally, when I invoke kill -SIGSTOP 1870508 (move process to T state) and then invoke kill -SIGINT 1870508 it doesn't terminate process... Why?
Yakog (517 rep)
Jan 13, 2025, 09:48 PM • Last activity: Jan 14, 2025, 10:21 AM
0 votes
1 answers
111 views
How to compile Go programs in AltLinux?
I'm trying to install aptly from source (I'm using [Simply Linux 9][1]), I followed their instructions under the [BINARY RELEASES][2] section: ```lang-shellsession $ git clone https://github.com/aptly-dev/aptly` ``` But I'm getting this error: ```lang-shellsession $ make install go generate go insta...
I'm trying to install aptly from source (I'm using Simply Linux 9 ), I followed their instructions under the BINARY RELEASES section:
-shellsession
$ git clone https://github.com/aptly-dev/aptly` 
But I'm getting this error:
-shellsession
$ make install
    go generate
    go install -v
    main.go:11:2: package embed is not in GOROOT (/usr/lib/golang/src/embed)
    make: *** [Makefile:32: install] Error 1
Ekaterina Ivanova iceja.net (260 rep)
Sep 8, 2022, 01:23 PM • Last activity: Dec 3, 2024, 12:11 PM
1 votes
0 answers
66 views
Command works when path is entered manually, but not when $PATH is used
I installed Golang into a custom folder under `$HOME` called `.go/exec`. After the installation, it put the binary under `$HOME/.go/exec/go`. So I updated `$PATH` to contain this directory: `$HOME/.go/exec:$PATH`. Here is the question: When I execute a command by entering the path manually, it works...
I installed Golang into a custom folder under $HOME called .go/exec. After the installation, it put the binary under $HOME/.go/exec/go. So I updated $PATH to contain this directory: $HOME/.go/exec:$PATH. Here is the question: When I execute a command by entering the path manually, it works without any issues: ~/.go/exec/go/bin/go version However, with $PATH it does not work:
go version
# zsh: permission denied: go
I am logged in with $USER, and seems like permissions are set correctly. Here is a namei output:
pwd
# /home/user

namei -olm ./.go/exec/go/bin/go

drwxr-x--- user user .
drwxrwxr-x user user .go
drwxrwxr-x user user exec
drwxr-xr-x user user go
drwxr-xr-x user user bin
-rwxr-xr-x user user go
Could anyone guide me where the issue is? I thought just adding the top directory to $PATH should have been enough, am I wrong?
Berk Açıkgöz (11 rep)
Jul 5, 2024, 09:29 AM • Last activity: Jul 6, 2024, 10:19 AM
1 votes
1 answers
70 views
Pi Zero Cross Compilation Floating Point Specification
I am trying to cross compile a go project (syzkaller) to target a Pi Zero so it can emulate usb devices. The problem is that I have been unable to find information regarding how to specify the proper floating point flag to ensure compatibility with the Pi Zero. Everything I have tried results in the...
I am trying to cross compile a go project (syzkaller) to target a Pi Zero so it can emulate usb devices. The problem is that I have been unable to find information regarding how to specify the proper floating point flag to ensure compatibility with the Pi Zero. Everything I have tried results in the VMOV assembly instruction being in the binary file and throwing an illegal instruction. My host machine is x86_64 running go1.21.4 and the pi zero is arm6l running go1.21.4. When cross compiling I am using GOOS=linux GOARCH=arm GOARM=5. The makefile I am using can be found here: https://github.com/google/syzkaller/blob/master/Makefile (I am compiling the execprog binary). From my research the GOARM=5 should be forcing software floating point operations, but the information sources are very outdated. I have also tried compiling for armv5 with no success. I also could be using the flag incorrectly since I am not very familiar with GO. Below are the exact compilation arguments for the binary. Any advice is appreciated, thanks. Must remake target 'execprog'. GOOS=linux GOARCH=arm go build "-ldflags=-s -w -X github.com/google/syzkaller/prog.\ GitRevision=121701b62358a454bbfdccfadfcce9bb843602d6+ -X 'github.com/google/syzkaller\ /prog.gitRevisionDate=20240605-134717'" "-tags=syz_target syz_os_linux syz_arch_armv6\ GOARM=5" -o ./bin/linux_arm/syz-execprog github.com/google/syzkaller/tools/syz-execprog
Darrion Ramos (23 rep)
Jun 28, 2024, 03:30 AM • Last activity: Jun 28, 2024, 04:55 AM
0 votes
1 answers
221 views
envoy proxy running on localhost works fine from curl, but times out from golang "hey" tool
I'm stepping through some Envoy tutorials (probably doesn't matter if you don't know what that is). I'm doing this on my Ubuntu VM (Windows 11 host) and I'm behind a corporate firewall. We run a specific version of Envoy by running a "func-e" command line, which is a tool for dynamically installing...
I'm stepping through some Envoy tutorials (probably doesn't matter if you don't know what that is). I'm doing this on my Ubuntu VM (Windows 11 host) and I'm behind a corporate firewall. We run a specific version of Envoy by running a "func-e" command line, which is a tool for dynamically installing and running a specific version of Envoy. The output of this shows that it's listening on port 10000. In another shell, I can run "curl http://localhost:10000" and it returns the expected output from the Envoy proxy. In that same shell, I am trying to use a golang tool called "hey", which is a simple load testing tool. You simply give it the url you want to bang on and it returns the results. In this case, I'm running it with a trivial configuration, like this: hey -n 1 -c 1 http://localhost:10000 This says to send one request, with a single worker. What this does is time out, after the preconfigured 20 second timeout. If I first disconnect my laptop from the VPN and run this test, it works fine. I would think this problem has something to do with the proxy settings in the shell, specifically the "no_proxy" variable. In that comma-separated list, I have both "localhost" and "127.0.0.1" (just in case, the "NO_PROXY" variable has the same value).
David M. Karr (1173 rep)
Mar 18, 2024, 06:13 PM • Last activity: Mar 21, 2024, 09:42 PM
3 votes
0 answers
760 views
named pipe (mkfifo): how to detect on macos that the reading end (consumer) has disconnected, without the consumer writing to the write end?
**Note:** this is about the **producer** detecting the consumer disconnecting, not the _consumer_ detecting that the producer disconnected (aka EOF). The producer might not write any data for long periods, but want to quickly find out that the consumer has disconnected. ## General Sequence of Events...
**Note:** this is about the **producer** detecting the consumer disconnecting, not the _consumer_ detecting that the producer disconnected (aka EOF). The producer might not write any data for long periods, but want to quickly find out that the consumer has disconnected. ## General Sequence of Events: 1. consumer (Wireshark) creates a named pipe (using mkfifo) and opens its reading end. 2. producer (a so-called Wireshark external capture program, aka extcap) gets started and the name/path of the named pipe passed. 3. producer opens writing end as O_WRONLY and initially writes some data into the pipe. 4. _crickets_ 5. user presses Stop button in Wireshark, Wireshark then closes its reading end of the pipe. 6. ???trying to detect in producer that consumer has disconnected from named pipe, even if producer has no data to send??? ## Linux On Linux in the producer, using the select syscall with the fd for the write end of the named pipe in the read fd set will return the writing end fd become readable upon the consumer disconnecting. ## MacOS However, on macos, the write end fd of the named pipe **becomes readable(sic!) whenever the producer writes data**. It does **not** become readable upon the consumer disconnecting. EDIT: Adding an error fd set doesn't change the situation; there is never an error fd set. /EDIT Any ideas as to how detect the consumer disconnecting from a named pipe on macos, without SIGPIPE as there might be no writes for a long time, but the user already stopped Wireshark recording? ## Consumer Disconnect Detection on Named Pipe for Producer https://github.com/siemens/cshargextcap/blob/macos/pipe/checker_notwin.go
package pipe

import (
	"os"

	"golang.org/x/sys/unix"

	log "github.com/sirupsen/logrus"
)

// WaitTillBreak continuously checks a fifo/pipe to see when it breaks. When
// called, WaitTillBreak blocks until the fifo/pipe finally has broken.
//
// This implementation leverages [syscall.Select].
func WaitTillBreak(fifo *os.File) {
	log.Debug("constantly monitoring packet capture fifo status...")
	fds := unix.FdSet{}
	for {
		// Check the fifo becomming readable, which signals that it has been
		// closed. In this case, ex-termi-nate ;) Oh, and remember to correctly
		// initialize the fdset each time before calling select() ... well, just
		// because that's a good idea to do. :(
		fds.Set(int(fifo.Fd()))
		n, err := unix.Select(
			int(fifo.Fd())+1, // highest fd is our file descriptor.
			&fds, nil, nil,   // only watch readable.
			nil, // no timeout, ever.
		)
		if n != 0 || err != nil {
			// Either the pipe was broken by Wireshark, or we did break it on
			// purpose in the piping process. Anyway, we're done.
			log.Debug("capture fifo broken, stopped monitoring.")
			return
		}
	}
}
## Unit Test That Produces Incorrect Behavior on MacOS https://github.com/siemens/cshargextcap/blob/macos/pipe/checker_notwin_test.go -- fails the assertion that WaitTillBreak must not return before we actually closed the consumer end of the named pipe.
package pipe

import (
	"io"
	"os"
	"time"

	. "github.com/onsi/ginkgo/v2"
	. "github.com/onsi/gomega"
	. "github.com/thediveo/success"
	"golang.org/x/sys/unix"
)

var _ = Describe("pipes", func() {

	It("detects on the write end when a pipe breaks", func() {
		// As Wireshark uses a named pipe it passes an extcap its name (path)
		// and then expects the extcap to open this named pipe for writing
		// packet capture data into it. For this test we simulate Wireshark
		// closing its reading end and we must properly detect this situation on
		// our writing end of the pipe.
		By("creating a temporary named pipe/fifo and opening its ends")
		tmpfifodir := Successful(os.MkdirTemp("", "test-fifo-*"))
		defer os.RemoveAll(tmpfifodir)

		fifoname := tmpfifodir + "/fifo"
		unix.Mkfifo(fifoname, 0660)
		wch := make(chan *os.File)
		go func() {
			defer GinkgoRecover()
			wch ", 1900), "pipe wasn't broken yet")
	})

})
### Poll-Based Version This doesn't work on macos either, never returning any POLLERR. It does work correctly on Linux, however.
package pipe

import (
	"os"

	"golang.org/x/sys/unix"

	log "github.com/sirupsen/logrus"
)

// WaitTillBreak continuously checks a fifo/pipe to see when it breaks. When
// called, WaitTillBreak blocks until the fifo/pipe finally has broken.
//
// This implementation leverages [unix.Poll].
func WaitTillBreak(fifo *os.File) {
	log.Debug("constantly monitoring packet capture fifo status...")
	fds := []unix.PollFd{
		{
			Fd:     int32(fifo.Fd()),
			Events: 0,
		},
	}
	for {
		// Check the fifo becomming readable, which signals that it has been
		// closed. In this case, ex-termi-nate ;) Oh, and remember to correctly
		// initialize the fdset each time before calling select() ... well, just
		// because that's a good idea to do. :(
		n, err := unix.Poll(fds, 1000 /*ms*/)
		if err != nil {
			if err == unix.EINTR {
				continue
			}
			log.Debugf("capture fifo broken, reason: %s", err.Error())
			return
		}
		if n <= 0 {
			continue
		}
		log.Debugf("poll: %+v", fds)
		if fds.Revents&unix.POLLERR != 0 {
			// Either the pipe was broken by Wireshark, or we did break it on
			// purpose in the piping process. Anyway, we're done.
			log.Debug("capture fifo broken, stopped monitoring.")
			return
		}
	}
}
TheDiveO (1427 rep)
Dec 15, 2023, 02:47 PM • Last activity: Dec 21, 2023, 08:11 PM
-2 votes
2 answers
1706 views
How to unistalled Go tools in Linux using command line?
I installed `cf` using go get github.com/xalanq/cf-tool cd $GOPATH/src/github.com/xalanq/cf-tool go build -ldflags "-s -w" cf.go cf --version output: Codeforces Tool (cf) v1.0.0 I tried to uninstall it using sudo apt-get --purge remove Codeforces\ Tool && sudo apt-get autoremove and sudo apt-get --p...
I installed cf using go get github.com/xalanq/cf-tool cd $GOPATH/src/github.com/xalanq/cf-tool go build -ldflags "-s -w" cf.go cf --version output: Codeforces Tool (cf) v1.0.0 I tried to uninstall it using sudo apt-get --purge remove Codeforces\ Tool && sudo apt-get autoremove and sudo apt-get --purge remove cf && sudo apt-get autoremove but iam getting error like E: Unable to locate package Codeforces Tool and E: Unable to locate package cf but its' showing error how to unistall this
MdNihal05 (1 rep)
Aug 28, 2023, 06:30 AM • Last activity: Aug 28, 2023, 08:59 AM
0 votes
0 answers
231 views
Is it possible to change the file permission of itself
I created a binary file with Go Language. The owner of the file will be "userA" and the execution permission is set as "userA". The above configurations is enabled using the following commands ``` sudo chown userA:userA ./program sudo chmod a+s ./program ``` Is it possible to change the ownership of...
I created a binary file with Go Language. The owner of the file will be "userA" and the execution permission is set as "userA". The above configurations is enabled using the following commands
sudo chown userA:userA ./program
sudo chmod a+s ./program
Is it possible to change the ownership of the program to userB and execution permission to userB inside the program binary file.
./program change-permission
This command should change the ownership of the running program to userB and execution permission to userB inside the program binary file. I tried the above commands as a shell script and tried change the ownership and execution permission of the same shell script and it didn't work as expected. Kindly can anyone advise on this and provide some sample command or code?
sabby (1 rep)
Jan 4, 2023, 09:25 AM • Last activity: Jan 4, 2023, 01:18 PM
0 votes
1 answers
620 views
Not able to install golang migrate on ubuntu 22.04
curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey | apt-key add - % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead...
curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey | apt-key add - % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). E: This command can only be used by root. 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0 100 3954 100 3954 0 0 2478 0 0:00:01 0:00:01 --:--:-- 2478 curl: (23) Failed writing body
Ubaid Aadil (11 rep)
Nov 17, 2022, 07:54 AM • Last activity: Nov 17, 2022, 08:49 AM
0 votes
1 answers
643 views
How to fix error Code bin root/go/bin not a valid identifier?
Trying to install chainlink on my laptop I had to install go. Doing so i think i have done something wrong and now i having error message each time I open ubuntu terminal which contents the following: ``` -bash: export: `Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:...
Trying to install chainlink on my laptop I had to install go. Doing so i think i have done something wrong and now i having error message each time I open ubuntu terminal which contents the following:
-bash: export: `Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/myusername/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/myusername/AppData/Local/Programs/Microsoft': not a valid identifier
-bash: export: `Code/bin:/snap/bin:/usr/local/go/bin:/root/go/bin': not a valid identifier
output after running command
grep 'export.*Files/Docker/Docker/resources/bin:' ~/.bashrc ~/.bash_profile ~/.bash_login ~/.profile /etc/profile /etc/bash.bashrc
/root/.bashrc:export PATH=/bin:/root/.nvm/versions/node/v16.13.2/bin:/root/.cache/cloud-code/installer/google-cloud-sdk/bin:/root/.vscode-server/bin/d045a5eda657f4d7b676/bin/remote-cli:/root/.local/share/solana/install/active_release/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/lonar/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/lonar/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin:/usr/local/go/bin:/root/go/bin
grep: /root/.bash_profile: No such file or directory
grep: /root/.bash_login: No such file or directory
is there a way to remove/delete these or to fix the error full stop,please?
Leo (101 rep)
Oct 25, 2022, 03:27 PM • Last activity: Oct 25, 2022, 04:34 PM
0 votes
0 answers
649 views
What's the best way to upgrade Go to 1.18 on Alma Linux?
I need to upgrade the version of Go on my Alma Linux 8 box from the installed version 1.16 to the latest 1.18. There are several tutorials on how to install, but I haven’t found any for upgrade specifically, as there were for PHP. The reason I ask is because Go is already installed, and I want to ma...
I need to upgrade the version of Go on my Alma Linux 8 box from the installed version 1.16 to the latest 1.18. There are several tutorials on how to install, but I haven’t found any for upgrade specifically, as there were for PHP. The reason I ask is because Go is already installed, and I want to make sure I’d correctly upgrade if there’s a process already in place. dnf list golang gives me: Installed Packages golang.x86_64 1.16.12-1.module_el8.5.0+2604+960c7771 @appstream Or, do I re-install from scratch, like this ?
vintorg (103 rep)
Apr 23, 2022, 03:25 AM • Last activity: Jul 20, 2022, 10:15 AM
1 votes
1 answers
1207 views
gmail sendgmail configuration for git send-email
[From May 30, 2022][1]: > Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password. This is a problem for various applications including [`git send-email`][2]. [`sendgmail`][3] is tool from Google written i...
From May 30, 2022 : > Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password. This is a problem for various applications including git send-email . sendgmail is tool from Google written in go which allows to use OAuth2 credentials. Using sendgmail requires certain configuration in Google Cloud , download JSON with configuration and rename to ~/.sendgmail.json and then run once: $ GOPATH/bin/sendgmail -sender=USERNAME@gmail.com -setup 1. Ensure that you are logged in as USERNAME@gmail.com in your browser. 2. Open the following link and authorise sendgmail: https://accounts.google.com/o/oauth2/auth ?... 3. Enter the authorisation code: My ~/.sendgmail.json contains redirect_uris":["http://localhost"], therefore clicked website is redirected to localhost (no webserver is on my machine) and I don't get the authorisation code. Could anybody explain what exactly to do in Google Cloud setup to get it working?
pevik (1587 rep)
Jun 8, 2022, 07:12 AM • Last activity: Jun 16, 2022, 10:02 AM
1 votes
0 answers
905 views
Unable to install Bazel using Bazelisk
I want to install Bazel on linux 20.04 version. I have already installed go.\ I am trying to use the command ```go install github.com/bazelbuild/bazelisk@latest``` mentioned in [here](https://www.tensorflow.org/install/source).\ Somehow I am unable to locate where the bazel file is installed. After...
I want to install Bazel on linux 20.04 version. I have already installed go.\ I am trying to use the command
install github.com/bazelbuild/bazelisk@latest
mentioned in [here](https://www.tensorflow.org/install/source).\ Somehow I am unable to locate where the bazel file is installed. After running the command
go install github.com/bazelbuild/bazelisk@latest
, terminal printed the following:
go: downloading github.com/bazelbuild/bazelisk v1.11.0
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/hashicorp/go-version v1.3.0
My go env variables are as follows:
GOBIN="/home/somepc/Desktop/TryBasel"
GOCACHE="/home/somepc/.cache/go-build"
GOENV="/home/somepc/.config/go/env"
GOMODCACHE="/usr/local/go/bin/pkg/mod"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
I have only included the env variables, which I felt were important to solve this issue. Kindly let me know in the comments if more information is needed!
A J (11 rep)
Apr 5, 2022, 11:55 AM
0 votes
0 answers
589 views
Ubuntu systemd using 100% CPU when running manually with sudo only uses 20%
I wrote a program in Golang (it is compiled) and ran it using systemd as it needs to run long-term, auto reboot and run on startup, but it's pinning the cpu at 100%. Comparatively when running using sudo through the terminal, it only uses about 20%. The program is very I/O intensive if that helps. I...
I wrote a program in Golang (it is compiled) and ran it using systemd as it needs to run long-term, auto reboot and run on startup, but it's pinning the cpu at 100%. Comparatively when running using sudo through the terminal, it only uses about 20%. The program is very I/O intensive if that helps. I was also reading this post which seems to have a similar issue and I tried running it behind a screen and nohup with systemd and still had the same problem. Also tried adding tty for I/O but that didn't seem to work either. Any help to get this to work or alternatives to systemd would be greatly appreciated.
[Unit]
Description=Program Description
Documentation=N/A
After=network.target

[Service]
Environment=PORT=54731
Type=simple
User=root
ExecStart=/home/ubuntu/GoProxy/proxy
Restart=on-failure

[Install]
WantedBy=multi-user.target
Edit: My program is a custom proxy solution I wrote. The intensive I/O is from having to read files for authentication checking and logging runtime info to a log file. Edit: I've used daemon with sudo (root perms) to run it with restart on crash and so far that's working fine. But I then tried to automatically start it with daemon when the server boots using cron and it has the same problem when doing this (I used cron through sudo, so should run as root)
Joshua Pinti (1 rep)
Feb 25, 2022, 05:53 AM • Last activity: Feb 25, 2022, 10:19 AM
0 votes
0 answers
130 views
Is there a darwin (arm64) equivalent of `O_PATH` for open?
I want to get the file descriptor without opening the file which can be attained by using the `O_PATH` flag on linux. ([ref](https://man7.org/linux/man-pages/man2/open.2.html)) This flag doesn't seem to be there on darwin. **Context** - I'm trying to use `open` through Go's `syscall.Open`. ([ref](ht...
I want to get the file descriptor without opening the file which can be attained by using the O_PATH flag on linux. ([ref](https://man7.org/linux/man-pages/man2/open.2.html)) This flag doesn't seem to be there on darwin. **Context** - I'm trying to use open through Go's syscall.Open. ([ref](https://pkg.go.dev/syscall#Open)) - The O_PATH flag is defined in the sys/unix package (not for darwin though). ([ref](https://cs.opensource.google/go/x/sys/+/3681064d:unix/zerrors_linux_amd64.go;l=170))
Alan (101 rep)
Feb 19, 2022, 09:33 AM
1 votes
0 answers
173 views
How to animate progress without overwriting other output?
Let's say I'm writing a program in Go that runs for a period of time while using ANSI control codes to animate a progress indicator line. For example, ```golang outer: for { select { case <-ticker: fmt.Printf("\033[%dF\033[J", linesToOverwrite) display() case <-waitChan: fmt.Printf("\033[%dF\033[J",...
Let's say I'm writing a program in Go that runs for a period of time while using ANSI control codes to animate a progress indicator line. For example,
outer:
	for {
		select {
		case <-ticker:
			fmt.Printf("\033[%dF\033[J", linesToOverwrite)
			display()
		case <-waitChan:
			fmt.Printf("\033[%dF\033[J", linesToOverwrite)
			display()
			break outer
		}
	}
}
This works except if a separate goroutine wants to print, such as when a worker has timed out. If goroutine prints, the line will be overwritten and the animated lines will be 'smeared'. Is there an easy way to solve this problem that doesn't require all print statements in my project to be rewritten to be aware of the animation logic? One solution is to write a print function wrapper that will buffer lines and then let the animating loop print the buffer in sync. But that means I would have to make all code in the project aware of the animation logic.
Sean (11 rep)
Feb 11, 2022, 02:56 PM
1 votes
0 answers
813 views
--enable-languages unrecognized option for configure
I am trying to do a build of gcc11 (on RHEL 7.6 which comes with 4.8.5 and no root access). When I run the following: ./configure --prefix=$HOME/gnu --enable-languages=c,c++ I get the response > configure: WARNING: unrecognized options: --enable-languages When I go to make, it runs through all the l...
I am trying to do a build of gcc11 (on RHEL 7.6 which comes with 4.8.5 and no root access). When I run the following: ./configure --prefix=$HOME/gnu --enable-languages=c,c++ I get the response > configure: WARNING: unrecognized options: --enable-languages When I go to make, it runs through all the languages and ultimately fails on the go portion (which I would love to turn off). Something about not supporting -fsplit-stack. So the way I am trying to solve this error in the libgo portion is to edit the enable-languages which I cannot do. Why is this unrecognized and is there anything I can do downstream to convince it not to try to build the full list of languages? **EDIT** Thanks for the help so far I continue to explore what I have read. A couple of extra pieces of information I neglected to say: 1) I am trying to do as explained on GNU Source Release Collection 2) The whole goal of this is to be >= 5. I don't need 11, I just need one that will build an executable correctly. Compared with 7,8,9 and 10 I seemed to get closer to the end with 11. I need >=5 for a python library I am trying to install.
LaptopProfile (41 rep)
Jan 26, 2022, 08:14 PM • Last activity: Jan 27, 2022, 02:19 PM
Showing page 1 of 20 total questions