remove unused

This commit is contained in:
James Bardin 2020-11-30 18:10:41 -05:00
parent bdfea50cc8
commit 44ccb94e2e
6 changed files with 2 additions and 67 deletions

View File

@ -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.

View File

@ -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() {}

View File

@ -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{}

View File

@ -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{},

View File

@ -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.

View File

@ -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()))
}