File tree Expand file tree Collapse file tree 9 files changed +31
-48
lines changed Expand file tree Collapse file tree 9 files changed +31
-48
lines changed Original file line number Diff line number Diff line change 22
33package main
44
5- import (
6- "os"
7-
8- "github.com/hyperledger-labs/fabric-builder-k8s/cmd"
9- )
5+ import "github.com/hyperledger-labs/fabric-builder-k8s/internal/cmd"
106
117func main () {
12- os . Exit ( cmd .Build () )
8+ cmd .Build ()
139}
Original file line number Diff line number Diff line change 22
33package main
44
5- import (
6- "os"
7-
8- "github.com/hyperledger-labs/fabric-builder-k8s/cmd"
9- )
5+ import "github.com/hyperledger-labs/fabric-builder-k8s/internal/cmd"
106
117func main () {
12- os . Exit ( cmd .Detect () )
8+ cmd .Detect ()
139}
Original file line number Diff line number Diff line change 22
33package main
44
5- import (
6- "os"
7-
8- "github.com/hyperledger-labs/fabric-builder-k8s/cmd"
9- )
5+ import "github.com/hyperledger-labs/fabric-builder-k8s/internal/cmd"
106
117func main () {
12- os . Exit ( cmd .Release () )
8+ cmd .Release ()
139}
Original file line number Diff line number Diff line change 22
33package main
44
5- import (
6- "os"
7-
8- "github.com/hyperledger-labs/fabric-builder-k8s/cmd"
9- )
5+ import "github.com/hyperledger-labs/fabric-builder-k8s/internal/cmd"
106
117func main () {
12- os . Exit ( cmd .Run () )
8+ cmd .Run ()
139}
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import (
1212 "github.com/hyperledger-labs/fabric-builder-k8s/internal/util"
1313)
1414
15- func Build () int {
15+ func Build () {
1616 const (
1717 expectedArgsLength = 4
1818 chaincodeSourceDirectoryArg = 1
@@ -29,7 +29,7 @@ func Build() int {
2929 "Expected CHAINCODE_SOURCE_DIR, CHAINCODE_METADATA_DIR and BUILD_OUTPUT_DIR arguments" ,
3030 )
3131
32- return 1
32+ os . Exit ( 1 )
3333 }
3434
3535 chaincodeSourceDirectory := os .Args [chaincodeSourceDirectoryArg ]
@@ -49,8 +49,8 @@ func Build() int {
4949 if err := build .Run (ctx ); err != nil {
5050 logger .Printf ("Error building chaincode: %+v" , err )
5151
52- return 1
52+ os . Exit ( 1 )
5353 }
5454
55- return 0
55+ os . Exit ( 0 )
5656}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import (
1313 "github.com/hyperledger-labs/fabric-builder-k8s/internal/util"
1414)
1515
16- func Detect () int {
16+ func Detect () {
1717 const (
1818 expectedArgsLength = 3
1919 chaincodeSourceDirectoryArg = 1
@@ -27,7 +27,7 @@ func Detect() int {
2727 if len (os .Args ) != expectedArgsLength {
2828 logger .Println ("Expected CHAINCODE_SOURCE_DIR and CHAINCODE_METADATA_DIR arguments" )
2929
30- return 1
30+ os . Exit ( 1 )
3131 }
3232
3333 chaincodeSourceDirectory := os .Args [chaincodeSourceDirectoryArg ]
@@ -47,8 +47,8 @@ func Detect() int {
4747 logger .Printf ("Error detecting chaincode: %+v" , err )
4848 }
4949
50- return 1
50+ os . Exit ( 1 )
5151 }
5252
53- return 0
53+ os . Exit ( 0 )
5454}
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import (
1212 "github.com/hyperledger-labs/fabric-builder-k8s/internal/util"
1313)
1414
15- func Release () int {
15+ func Release () {
1616 const (
1717 expectedArgsLength = 3
1818 buildOutputDirectoryArg = 1
@@ -26,7 +26,7 @@ func Release() int {
2626 if len (os .Args ) != expectedArgsLength {
2727 logger .Println ("Expected BUILD_OUTPUT_DIR and RELEASE_OUTPUT_DIR arguments" )
2828
29- return 1
29+ os . Exit ( 1 )
3030 }
3131
3232 buildOutputDirectory := os .Args [buildOutputDirectoryArg ]
@@ -43,8 +43,8 @@ func Release() int {
4343 if err := release .Run (ctx ); err != nil {
4444 logger .Printf ("Error releasing chaincode: %+v" , err )
4545
46- return 1
46+ os . Exit ( 1 )
4747 }
4848
49- return 0
49+ os . Exit ( 0 )
5050}
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ func getChaincodeStartTimeout(logger *log.CmdLogger) (chaincodeStartTimeoutDurat
113113 return chaincodeStartTimeoutDuration , true
114114}
115115
116- func Run () int {
116+ func Run () {
117117 const (
118118 expectedArgsLength = 3
119119 buildOutputDirectoryArg = 1
@@ -127,7 +127,7 @@ func Run() int {
127127 if len (os .Args ) != expectedArgsLength {
128128 logger .Println ("Expected BUILD_OUTPUT_DIR and RUN_METADATA_DIR arguments" )
129129
130- return 1
130+ os . Exit ( 1 )
131131 }
132132
133133 buildOutputDirectory := os .Args [buildOutputDirectoryArg ]
@@ -141,27 +141,27 @@ func Run() int {
141141
142142 peerID , ok := getPeerID (logger )
143143 if ! ok {
144- return 1
144+ os . Exit ( 1 )
145145 }
146146
147147 kubeconfigPath := getKubeconfigPath (logger )
148148 kubeNamespace := getKubeNamespace (logger )
149149
150150 kubeNodeRole , ok := getKubeNodeRole (logger )
151151 if ! ok {
152- return 1
152+ os . Exit ( 1 )
153153 }
154154
155155 kubeServiceAccount := getKubeServiceAccount (logger )
156156
157157 kubeNamePrefix , ok := getKubeNamePrefix (logger )
158158 if ! ok {
159- return 1
159+ os . Exit ( 1 )
160160 }
161161
162162 chaincodeStartTimeout , ok := getChaincodeStartTimeout (logger )
163163 if ! ok {
164- return 1
164+ os . Exit ( 1 )
165165 }
166166
167167 run := & builder.Run {
@@ -179,8 +179,8 @@ func Run() int {
179179 if err := run .Run (ctx ); err != nil {
180180 logger .Printf ("Error running chaincode: %+v" , err )
181181
182- return 1
182+ os . Exit ( 1 )
183183 }
184184
185- return 0
185+ os . Exit ( 0 )
186186}
Original file line number Diff line number Diff line change @@ -8,10 +8,9 @@ package integration_test
88import (
99 "context"
1010 "fmt"
11- "os"
1211 "testing"
1312
14- "github.com/hyperledger-labs/fabric-builder-k8s/cmd"
13+ "github.com/hyperledger-labs/fabric-builder-k8s/internal/ cmd"
1514 "github.com/hyperledger-labs/fabric-builder-k8s/test"
1615 "github.com/rogpeppe/go-internal/testscript"
1716 batchv1 "k8s.io/api/batch/v1"
@@ -71,7 +70,7 @@ func TestMain(m *testing.M) {
7170 })
7271
7372 wm := test .NewWrappedM (m , testenv )
74- os . Exit ( testscript .RunMain (wm , map [string ]func () int {
73+ testscript .Main (wm , map [string ]func (){
7574 "run" : cmd .Run ,
76- }))
75+ })
7776}
You can’t perform that action at this time.
0 commit comments