Команда Make говорит, что Go не установлен, но он (18.04)

Я имею дело с языком Go, который не устанавливается для сборки Docker-Machine из исходников, несмотря на он устанавливается и добавляется в ПУТЬ :

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$

Makefile:

# 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

main.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
1
задан 5 December 2020 в 02:28

1 ответ

Когда вы выполняете make с sudo, он наследует базовую целевую пользовательскую среду, которая не включает никаких изменений в PATH

Ex вызывающего пользователя. . задано

$ cat Makefile
.PHONY: listpath

listpath:
        @echo $(shell echo $$PATH)

затем

$ make listpath
/home/steeldriver/bin:/home/steeldriver/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

$ sudo make listpath
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

Если возможно, всегда создавайте программное обеспечение в собственном каталоге пользователя — так вы избежите проблем с разрешениями и соблазна перебора их с помощью sudo.

1
ответ дан 4 December 2020 в 19:12

Другие вопросы по тегам:

Похожие вопросы: