Created
March 22, 2017 21:58
-
-
Save yudai/b1aaf38ed9bbcc1d3717aa853018b811 to your computer and use it in GitHub Desktop.
Revisions
-
yudai created this gist
Mar 22, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ package somepackage import ( "github.com/docker/docker/client" libcomposeclient "github.com/docker/libcompose/docker/client" "github.com/docker/libcompose/project" ) type clientFactory struct { client *client.Client } func newClientFactory() (*clientFactory, error) { apiClient, err := libcomposeclient.Create(libcomposeclient.Options{}) if err != nil { return nil, err } return &clientFactory{ client: apiClient.(*client.Client), // to get Close() accessible }, nil } func (s *clientFactory) Create(service project.Service) client.APIClient { return s.client } func (s *clientFactory) Close() { s.client.Close() }