Skip to content

Commit 512265f

Browse files
committed
[FAB-2122] Simplify the go-install directives
We clean up some unecessary logic related to creating chaincode binaries with a desired name. This refactor lays the groundwork for FAB-2122 fixes later in the series. Change-Id: I3ad8c6f7701ef5bb8e8f148f8c8f58ea3e0d9587 Signed-off-by: Greg Haskins <[email protected]>
1 parent 9b2612a commit 512265f

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

core/chaincode/platforms/golang/platform.go

+1-11
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,10 @@ func (goPlatform *Platform) GenerateDockerfile(cds *pb.ChaincodeDeploymentSpec)
137137
return "", fmt.Errorf("could not decode url: %s", err)
138138
}
139139

140-
toks := strings.Split(urlLocation, "/")
141-
if toks == nil || len(toks) == 0 {
142-
return "", fmt.Errorf("cannot get path components from %s", urlLocation)
143-
}
144-
145-
chaincodeGoName := toks[len(toks)-1]
146-
if chaincodeGoName == "" {
147-
return "", fmt.Errorf("could not get chaincode name from path %s", urlLocation)
148-
}
149-
150140
buf = append(buf, cutil.GetDockerfileFromConfig("chaincode.golang.Dockerfile"))
151141
buf = append(buf, "ADD codepackage.tgz $GOPATH")
152142
//let the executable's name be chaincode ID's name
153-
buf = append(buf, fmt.Sprintf("RUN go install %s && mv $GOPATH/bin/%s $GOPATH/bin/%s", urlLocation, chaincodeGoName, spec.ChaincodeId.Name))
143+
buf = append(buf, fmt.Sprintf("RUN go build -o $GOPATH/bin/%s %s", spec.ChaincodeId.Name, urlLocation))
154144

155145
dockerFileContents := strings.Join(buf, "\n")
156146

0 commit comments

Comments
 (0)