gpt4 book ai didi

linux - 'ln' 脚本有一些错误

转载 作者:IT王子 更新时间:2023-10-29 01:43:08 25 4
gpt4 key购买 nike

有人熟悉 etcd 项目吗?或者我们在谈论这个问题时最好忘记项目。问题是

$ build
ln: `gopath/src/github.com/coreos/etcd': cannot overwrite directory

当执行 build shell 时内容是:

#!/bin/sh -e

if [ ! -h gopath/src/github.com/coreos/etcd ]; then
mkdir -p gopath/src/github.com/coreos/
ln -s ../../../.. gopath/src/github.com/coreos/etcd
fi

export GOBIN=${PWD}/bin
export GOPATH=${PWD}/gopath
export GOFMTPATH="./bench ./config ./discovery ./etcd ./error ./http ./log main.go ./metrics ./mod ./server ./store ./tests"

# Don't surprise user by formatting their codes by stealth
if [ "--fmt" = "$1" ]; then
gofmt -s -w -l $GOFMTPATH
fi

go install github.com/coreos/etcd
go install github.com/coreos/etcd/bench

一些补充:我的系统是windows 7
我在 git bash 上运行 shell。问题重现:

step1: open the git bash
step2: git clone git@github.com:coreos/etcd.git
step3: cd etcd
step4: build

最佳答案

如“Git Bash Shell fails to create symbolic links”中所述(因为您在 Windows 7 上的 git bash 中使用该脚本)

the ln that shipped with msysGit simply tries to copy its arguments, rather than fiddle with links. This is because links only work (sort of) on NTFS filesystems, and the MSYS team didn't want to reimplement ln.

A workaround is to run mklink from Bash.
This also allows you to create either a Symlink or a Junction.

所以 'ln' 在 Git for Windows 附带的旧 shell 中默认情况下不会按预期工作。

关于linux - 'ln' 脚本有一些错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25396511/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com