bmc icon indicating copy to clipboard operation
bmc copied to clipboard

Replace .Close() methods with value returned from New*()

Open gebn opened this issue 5 years ago • 2 comments

It's harder to forget to call .Close() when you are given a function explicitly when dialling a BMC or creating a session.

machine, close, err := bmc.DialV2(...)
if err != nil {
    return err
}
defer close()  // not machine.Close()
...

gebn avatar May 09 '20 16:05 gebn

On the contrary, it does introduce another name into the scope.

gebn avatar May 24 '20 00:05 gebn

Needs to return the same type for Dial() and NewSession()

gebn avatar May 24 '20 00:05 gebn