Removing refs to `github.com/marstr/randname`

There are some portability concerns with adopting `randname`. Chiefly,
it would mean that dictionaries of words to use for randomness would
need to be dristributed with the mirrorcat executable. Given that we can
achieve the same effect, but with less readable names using `ioutil`,
this change is pretty important.
This commit is contained in:
Martin Strobel 2017-12-08 10:53:14 -08:00
Родитель 18b5d26048
Коммит f9a37e9188
4 изменённых файлов: 14 добавлений и 27 удалений

16
Gopkg.lock сгенерированный
Просмотреть файл

@ -19,18 +19,6 @@
revision = "be5ece7dd465ab0765a9682137865547526d1dfb"
version = "v1.7.3"
[[projects]]
name = "github.com/marstr/collection"
packages = ["."]
revision = "871b1cfa2ab97d3d8f54a034280907896190c346"
version = "v0.3.3"
[[projects]]
branch = "master"
name = "github.com/marstr/randname"
packages = ["."]
revision = "3ef1f47af99e66171417047e6f6fa334345e95e7"
[[projects]]
branch = "master"
name = "github.com/mitchellh/go-homedir"
@ -83,7 +71,7 @@
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "a0f4589a76f1f83070cb9e5613809e1d07b97c13"
revision = "b8f5ef32195cae6470b728e8ca677f0dbed1a004"
[[projects]]
branch = "master"
@ -100,6 +88,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "77b84724622048b1b4ae6107de50bcac235156d77a95061fd118772d6afb17a1"
inputs-digest = "c358996c3b6f44c7775b090da86e2c33ce9ff666c892ef538629db336061ad18"
solver-name = "gps-cdcl"
solver-version = 1

Просмотреть файл

@ -20,11 +20,6 @@
# name = "github.com/x/y"
# version = "2.4.0"
[[constraint]]
branch = "master"
name = "github.com/marstr/randname"
[[constraint]]
branch = "master"
name = "github.com/mitchellh/go-homedir"

Просмотреть файл

@ -4,12 +4,10 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"strings"
"github.com/marstr/randname"
)
// PushEvent encapsulates all data that will be provided by a GitHub Webhook PushEvent.
@ -71,7 +69,10 @@ func (ce CmdErr) Error() string {
func Push(ctx context.Context, original, mirror, ref string) (err error) {
const mirrorRemoteHandle = "other"
cloneLoc := path.Join(os.TempDir(), randname.Generate())
cloneLoc, err := ioutil.TempDir("", "mirrorcat")
if err != nil {
return
}
defer os.RemoveAll(cloneLoc)
runCmd := func(cmd *exec.Cmd) (err error) {

Просмотреть файл

@ -12,7 +12,6 @@ import (
"testing"
"github.com/Azure/mirrorcat"
"github.com/marstr/randname"
)
func ExampleNormalizeRef() {
@ -83,9 +82,13 @@ func TestNormalizeRef(t *testing.T) {
}
func TestPush(t *testing.T) {
var err error
locPrefix := path.Join(os.TempDir(), "test_push")
originalLoc, mirrorLoc := path.Join(locPrefix, randname.Generate()), path.Join(locPrefix, randname.Generate())
locPrefix, err := ioutil.TempDir("", "mirrorcat_test")
if err != nil {
t.Error()
t.FailNow()
}
originalLoc, mirrorLoc := path.Join(locPrefix, "leader"), path.Join(locPrefix, "follower")
t.Log("Original Repo Location: \t", originalLoc)
t.Log("Mirror Repo Location: \t", mirrorLoc)