AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[golang](ubuntu)

Martin Hope
Vimal
Asked: 2022-04-04 00:18:39 +0800 CST

如何使用 snap 在 Ubuntu 中安装特定版本的 Go

  • 1

我正在尝试使用 snap 包安装 Go 版本 1.16,但无法安装。相反,我得到了更新的版本。

无论当前可用的版本如何,我如何安装 1.16 版?

golang
  • 1 个回答
  • 1377 Views
Martin Hope
Mark
Asked: 2020-12-05 10:34:42 +0800 CST

Make 命令说 Go 没有安装,但它是(18.04)

  • 2

我正在处理没有安装 Go 语言以从源代码构建 Docker-Machine,尽管它已安装并添加到PATH:

utcloud@owncloud:/usr/local/bin/docker-machine$ sudo make
/bin/sh: 1: go: not found
rm -Rf /usr/local/bin/docker-machine/bin/*
utcloud@owncloud:/usr/local/bin/docker-machine$ go version
go version go1.9.3 linux/amd64

我能用这个做什么?

更新:

输出make:

utcloud@owncloud:/usr/local/bin/docker-machine$ make VERBOSE=1
rm -Rf /usr/local/bin/docker-machine/bin/*
utcloud@owncloud:/usr/local/bin/docker-machine$

生成文件:

# Plain make targets if not requested inside a container
ifneq (,$(findstring test-integration,$(MAKECMDGOALS)))
    include Makefile.inc
    include mk/main.mk
else ifneq ($(USE_CONTAINER), true)
    include Makefile.inc
    include mk/main.mk
else
# Otherwise, with docker, swallow all targets and forward into a container
DOCKER_BUILD_DONE := ""

test: .DEFAULT

.DEFAULT:
    @test ! -z "$(DOCKER_BUILD_DONE)" || ./script/build_in_container.sh $(MAKECMDGOALS)
    $(eval DOCKER_BUILD_DONE := "done")

endif

Makefile.inc:

# Project name, used to name the binaries
PKG_NAME := docker-machine

# If true, disable optimizations and does NOT strip the binary
DEBUG ?=
# If true, "build" will produce a static binary (cross compile always produce static build regardless)
STATIC ?=
# If true, turn on verbose output for build
VERBOSE ?=
# Build tags
BUILDTAGS ?=
# Adjust number of parallel builds (XXX not used)
PARALLEL ?= -1
# Coverage default directory
COVERAGE_DIR ?= cover
# Whether to perform targets inside a docker container, or natively on the host
USE_CONTAINER ?=

# List of cross compilation targets
ifeq ($(TARGET_OS),)
  TARGET_OS := darwin linux windows
endif

ifeq ($(TARGET_ARCH),)
  TARGET_ARCH := amd64 arm arm64 386
endif

# Output prefix, defaults to local directory if not specified
ifeq ($(PREFIX),)
  PREFIX := $(shell pwd)
endif

主.mk:

# Initialize version and gc flags
GO_LDFLAGS := -X `go list ./version`.GitCommit=`git rev-parse --short HEAD 2>/dev/null`
GO_GCFLAGS :=

# Full package list
PKGS := $(shell go list -tags "$(BUILDTAGS)" ./... | grep -v "/vendor/" | grep -v "/cmd")

# Resolving binary dependencies for specific targets
GOLINT_BIN := $(GOPATH)/bin/golint
GOLINT := $(shell [ -x $(GOLINT_BIN) ] && echo $(GOLINT_BIN) || echo '')

# Honor debug
ifeq ($(DEBUG),true)
    # Disable function inlining and variable registerization
    GO_GCFLAGS := -gcflags "-N -l"
else
    # Turn of DWARF debugging information and strip the binary otherwise
    GO_LDFLAGS := $(GO_LDFLAGS) -w -s
endif

# Honor static
ifeq ($(STATIC),true)
    # Append to the version
    GO_LDFLAGS := $(GO_LDFLAGS) -extldflags -static
endif

# Honor verbose
VERBOSE_GO := 
GO := go
ifeq ($(VERBOSE),true)
    VERBOSE_GO := -v
endif

include mk/build.mk
include mk/coverage.mk
include mk/dev.mk
include mk/test.mk
include mk/validate.mk

.all_build: build build-clean build-x
.all_coverage: coverage-generate coverage-html coverage-send coverage-serve coverage-clean
.all_release: release-checksum release
.all_test: test-short test-long test-integration
.all_validate: dco fmt vet lint

default: build

install:
    cp $(PREFIX)/bin/$(PKG_NAME) /usr/local/bin

clean: coverage-clean build-clean
test: dco fmt test-short lint vet
validate: dco fmt lint vet test-long

.PHONY: .all_build .all_coverage .all_release .all_test .all_validate test build validate clean
golang docker 18.04
  • 1 个回答
  • 1610 Views
Martin Hope
Neel Modi
Asked: 2020-05-19 02:15:56 +0800 CST

无法在 ubuntu 18.04 中安装 golangci-lint

  • 0

在我的 Ubuntu 18.04 中安装 vim-go 但按照以下步骤操作时出现错误,如下所示:-

vim-go: Error installing github.com/golangci/golangci-lint/cmd/golangci-lint@master: go: found github.com/golangci/golangci-lint/cmd/golangci-lint in github.com/golangci/golangci-lint v1.27.1-0.20200518075657-2c45244db801
vim-go: # github.com/golangci/golangci-lint/cmd/golangci-lint
vim-go: /mnt/d/go/pkg/tool/linux_amd64/link: running gcc failed: exec: "gcc": executable file not found in $PATH
vim-go: 
vim-go: installing finished!
Press ENTER or type command to continue

如何修复此错误?如果工作正常,其他一切。

vim golang vim-plugin
  • 1 个回答
  • 1089 Views
Martin Hope
Neel Modi
Asked: 2020-05-13 21:29:43 +0800 CST

go: 在wsl中安装go时找不到GOROOT目录错误

  • 1

我已经在我的根目录中安装了 go v1.14.2,授予它权限,然后将 go 文件夹移动到另一个驱动器

/mnt/d/go

现在在 .profile 和 .bashrc 文件中,我已经导出了 GOROOT 和 GOPATH,它看起来像这样。

export GOROOT=$mnt/d/go
export GOPATH=$mnt/d/go_space
export PATH=$PATH:/mnt/d/go/bin:$GOPATH/bin

在运行 go 版本时,我得到

go: cannot find GOROOT directory: /d/go
command-line permissions golang
  • 1 个回答
  • 12996 Views
Martin Hope
beli3ver
Asked: 2019-08-13 05:42:34 +0800 CST

Ubuntu Touch:获取 GPS 位置

  • 0

我想开发一个显示当前 gps 坐标的 ubuntu 触摸应用程序。使用 go 获取 GPS 位置的最佳方法是什么?我找不到任何文档。

谢谢你。

ubuntu-touch gps golang
  • 2 个回答
  • 626 Views
Martin Hope
ydhhat
Asked: 2019-01-12 22:55:04 +0800 CST

即使它的路径不在环境变量路径中,它仍然运行吗?

  • 0

我通过 snap 安装 go,go 的可执行文件的路径不在环境变量路径中,但是当我使用

go run test.go

在终端(从我的主目录)中,继续工作。

据我了解,go的可执行文件的路径必须在环境变量路径中,这样linux才能找到它所在的位置并运行它。在这种情况下,Linux如何找到go的可执行文件在哪里?

这是我的路径变量(在文件 /etc/environment 中)

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

这是go可执行文件的路径:

/snap/go/3095/bin/

我使用 linux mint xfce 18.3

environment-variables golang snap
  • 1 个回答
  • 1719 Views
Martin Hope
richie
Asked: 2018-11-14 07:17:12 +0800 CST

找不到命令“go”

  • 28

这不是一个编程问题。

我有一台运行 Ubuntu 的机器,我在上面安装了 Golang。它工作得很好......我什至运行了一些程序,但是“go1.11.2.linux-amd64.tar.gz”文件在我的主目录中,所以我认为可以将它移动到下载目录中。移动它后,我无法使用任何 Go 命令,并且找不到命令“go”。我尝试将文件移回主目录,但仍然遇到相同的错误。

任何人都可以向我解释发生了什么事吗?谢谢!!

richie@richie-ThinkPad-T430:~$ go version

Command 'go' not found, but can be installed with:

sudo snap install go         # version 1.11.2, or
sudo apt  install golang-go
sudo apt  install gccgo-go 

See 'snap info go' for additional versions.

我用来安装 Go 的命令:

wget https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.11.2.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
source ~/.profile
golang
  • 6 个回答
  • 129165 Views
Martin Hope
Ruby
Asked: 2018-07-21 07:55:10 +0800 CST

无法安装 Go dep

  • 1

我正在尝试dep ensure在我的 Ubuntu 16.04 上运行该命令,但系统无法找到该命令。当我运行sudo apt install dep或任何其他安装命令时,我总是在运行时收到此错误dep ensure:

No command 'dep' found, did you mean:
 Command 'dp' from package 'speech-tools' (universe)
 Command 'iep' from package 'emboss' (universe)
 Command 'dwp' from package 'binutils' (main)
 Command 'dex' from package 'dex' (universe)
 Command 'rep' from package 'rep' (universe)
 Command 'delp' from package 'fp-utils-3.0.0' (universe)
 Command 'xep' from package 'pvm-examples' (universe)
dep: command not found

有人告诉我我需要 Ubuntu 18 才能运行dep,但我想知道如何在我当前的 Ubuntu 上安装它。谢谢。

gnome-terminal dependencies golang 16.04
  • 3 个回答
  • 11111 Views
Martin Hope
Andy K
Asked: 2018-02-26 07:57:11 +0800 CST

如何在完全不同的文件夹上安装 golang 包并使其运行?

  • 0

我想将 go lang 包安装在单独的文件夹中,而不是apt-get install用来安装它。我不热衷于使用apt-get许多原因,在这里解释太长了。

我做了以下

apt-get download golang-go

然后我就这样解压了

dpkg -x golang-go_2%3a1.6-1ubuntu4_amd64.deb .

我有文件夹usr,在 3 个文件夹中bin,lib以及share其中的逻辑链接。

我的下一步应该是什么?

package-management apt golang
  • 1 个回答
  • 1150 Views
Martin Hope
Marty
Asked: 2010-07-31 08:19:02 +0800 CST

谷歌的 Go 语言有任何 PPA 吗?

  • 43

你知道谷歌 Go 语言的 PPA 的任何 URL 吗?

programming ppa golang
  • 8 个回答
  • 20134 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve