Skip to content

Commit

Permalink
remove unused
Browse files Browse the repository at this point in the history
  • Loading branch information
jbardin committed Dec 2, 2020
1 parent bdfea50 commit 44ccb94
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 67 deletions.
5 changes: 0 additions & 5 deletions repl/session.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package repl

import (
"errors"
"strings"

"github.com/zclconf/go-cty/cty"
Expand All @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions states/instance_generation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
17 changes: 0 additions & 17 deletions states/remote/remote.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package remote

import (
"fmt"

"github.com/hashicorp/terraform/states/statemgr"
)

Expand Down Expand Up @@ -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{}
39 changes: 0 additions & 39 deletions states/remote/remote_test.go
Original file line number Diff line number Diff line change
@@ -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{},
Expand Down
2 changes: 1 addition & 1 deletion states/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion states/state_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
}
Expand Down

0 comments on commit 44ccb94

Please sign in to comment.