This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compilation: | |
cloud_properties: | |
name: random | |
network: cf1 | |
reuse_compilation_vms: true | |
workers: 6 | |
director_uuid: 9bca5701-66c0-43ee-a4d0-64813b4b5ece | |
jobs: | |
- instances: 1 | |
name: consul_z1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compilation: | |
cloud_properties: | |
instance_type: m1.small | |
network: default | |
workers: 1 | |
director_uuid: fb70f16a-4d6f-41f8-bc2e-0181a03dff18 | |
jobs: | |
# - instances: 0 | |
# name: blobstore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func CopyFile(dstName, srcName string) (int64, error) { | |
src, e := os.Open(srcName) | |
if e != nil { | |
return 0, errors.New("Error while opening file for reading. Caused by: " + e.Error()) | |
} | |
dst, e := os.Create(dstName) | |
if e != nil { | |
src.Close() | |
return 0, errors.New("Error while opening file for writing. Caused by: " + e.Error()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func CopyFile(dstName, srcName string) (written int64, err error) { | |
src, err := os.Open(srcName) | |
if err != nil { | |
return | |
} | |
defer src.Close() | |
dst, err := os.Create(dstName) | |
if err != nil { | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SafeCloser bool | |
func (safeCloser *SafeCloser) Close(closer io.Closer) error { | |
if *safeCloser { | |
return nil | |
} | |
*safeCloser = true | |
return closer.Close() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func CopyFile(dstName, srcName string) (int64, error) { | |
src, e := os.Open(srcName) | |
if e != nil { | |
return 0, errors.New("Error while opening file for reading. Caused by: " + e.Error()) | |
} | |
var safeSrcCloser multicloser.SafeCloser | |
defer safeSrcCloser.Close(src) | |
dst, e := os.Create(dstName) | |
if e != nil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
writer := gcpClient.Bucket("my-gcp-bucket").Object("my-object").NewWriter(context.TODO()) | |
defer writer.Close() | |
_, e := io.Copy(writer, src) | |
if e != nil { | |
return errors.Wrapf(e, "Path %v", path) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
virtualGuestService, e := softlayerClient.GetSoftLayer_Virtual_Guest_Service() | |
if e != nil { | |
return cli.NewExitError(e.Error(), 1) | |
} | |
server := cliContext.GlobalString("server") | |
port := cliContext.GlobalInt("port") | |
if server == "" { | |
return cli.NewExitError(e.Error(), 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
virtualGuestService := softlayerClient.GetSoftLayer_Virtual_Guest_Service() or_on_error e { | |
fail_with cli.NewExitError(e.Error(), 1) | |
} | |
server := cliContext.GlobalString("server") | |
port := cliContext.GlobalInt("port") | |
if server == "" { | |
fail_with cli.NewExitError("server not provided as input flag", 1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Caller(arg int) { | |
result := SomeFunction(arg) on_error e { | |
fmt.Printf("Wrong input: %v", e) | |
return | |
} | |
fmt.Printf("Result: %v", result) | |
} | |
func SomeFunction(arg int) int fails_with error { | |
if arg == 42 { |
OlderNewer