diff --git a/repl/session.go b/repl/session.go index 1cb7028a3..dabe4fa10 100644 --- a/repl/session.go +++ b/repl/session.go @@ -1,7 +1,6 @@ package repl import ( - "errors" "strings" "github.com/zclconf/go-cty/cty" @@ -12,10 +11,6 @@ import ( "github.com/hashicorp/terraform/tfdiags" ) -// ErrSessionExit is a special error result that should be checked for -// from Handle to signal a graceful exit. -var ErrSessionExit = errors.New("session exit") - // Session represents the state for a single REPL session. type Session struct { // Scope is the evaluation scope where expressions will be evaluated. diff --git a/states/instance_generation.go b/states/instance_generation.go index 617ad4ea6..891adc003 100644 --- a/states/instance_generation.go +++ b/states/instance_generation.go @@ -18,7 +18,3 @@ type Generation interface { // CurrentGen is the Generation representing the currently-active object for // a resource instance. var CurrentGen Generation - -type currentGen struct{} - -func (g currentGen) generation() {} diff --git a/states/remote/remote.go b/states/remote/remote.go index d3d3f7b2b..0dab1863c 100644 --- a/states/remote/remote.go +++ b/states/remote/remote.go @@ -1,8 +1,6 @@ package remote import ( - "fmt" - "github.com/hashicorp/terraform/states/statemgr" ) @@ -38,18 +36,3 @@ type Payload struct { // Factory is the factory function to create a remote client. type Factory func(map[string]string) (Client, error) - -// NewClient returns a new Client with the given type and configuration. -// The client is looked up in the BuiltinClients variable. -func NewClient(t string, conf map[string]string) (Client, error) { - f, ok := BuiltinClients[t] - if !ok { - return nil, fmt.Errorf("unknown remote client type: %s", t) - } - - return f(conf) -} - -// BuiltinClients is the list of built-in clients that can be used with -// NewClient. -var BuiltinClients = map[string]Factory{} diff --git a/states/remote/remote_test.go b/states/remote/remote_test.go index 1e8edc8b8..55e23342a 100644 --- a/states/remote/remote_test.go +++ b/states/remote/remote_test.go @@ -1,50 +1,11 @@ package remote import ( - "bytes" "crypto/md5" "encoding/json" "testing" - - "github.com/hashicorp/terraform/states/statefile" - "github.com/hashicorp/terraform/states/statemgr" ) -// testClient is a generic function to test any client. -func testClient(t *testing.T, c Client) { - var buf bytes.Buffer - s := statemgr.TestFullInitialState() - sf := &statefile.File{State: s} - if err := statefile.Write(sf, &buf); err != nil { - t.Fatalf("err: %s", err) - } - data := buf.Bytes() - - if err := c.Put(data); err != nil { - t.Fatalf("put: %s", err) - } - - p, err := c.Get() - if err != nil { - t.Fatalf("get: %s", err) - } - if !bytes.Equal(p.Data, data) { - t.Fatalf("bad: %#v", p) - } - - if err := c.Delete(); err != nil { - t.Fatalf("delete: %s", err) - } - - p, err = c.Get() - if err != nil { - t.Fatalf("get: %s", err) - } - if p != nil { - t.Fatalf("bad: %#v", p) - } -} - func TestRemoteClient_noPayload(t *testing.T) { s := &State{ Client: nilClient{}, diff --git a/states/resource.go b/states/resource.go index 0b6a45092..28223671d 100644 --- a/states/resource.go +++ b/states/resource.go @@ -135,7 +135,7 @@ func (i *ResourceInstance) GetGeneration(gen Generation) *ResourceInstanceObject return i.Deposed[dk] } if gen == nil { - panic(fmt.Sprintf("get with nil Generation")) + panic("get with nil Generation") } // Should never fall out here, since the above covers all possible // Generation values. diff --git a/states/state_string.go b/states/state_string.go index b76add4fd..0f74d5965 100644 --- a/states/state_string.go +++ b/states/state_string.go @@ -197,7 +197,7 @@ func (ms *Module) testString() string { } if obj := is.Current; obj != nil && len(obj.Dependencies) > 0 { - buf.WriteString(fmt.Sprintf("\n Dependencies:\n")) + buf.WriteString("\n Dependencies:\n") for _, dep := range obj.Dependencies { buf.WriteString(fmt.Sprintf(" %s\n", dep.String())) }