Avoid pointer reference of immutable methods
This commit is contained in:
@@ -237,9 +237,9 @@ func dodiffRecursive(firstClnt, secondClnt client.Client, ch chan DiffMessage) {
|
||||
|
||||
firstSortedList := sortedList{}
|
||||
secondSortedList := sortedList{}
|
||||
id := randomID(8)
|
||||
firstid := id + ".1"
|
||||
secondid := id + ".2"
|
||||
id := newRandomID(8)
|
||||
firstid := id + ".firstURL"
|
||||
secondid := id + ".secondURL"
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ func newSessionV2() *sessionV2 {
|
||||
s.Header.CommandArgs = nil
|
||||
s.Header.When = time.Now().UTC()
|
||||
s.mutex = new(sync.Mutex)
|
||||
s.SessionID = randomID(8)
|
||||
s.SessionID = newRandomID(8)
|
||||
|
||||
sessionDataFile, perr := getSessionDataFile(s.SessionID)
|
||||
fatalIf(perr.Trace(s.SessionID), "Unable to create session data file \""+sessionDataFile+"\".")
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import (
|
||||
|
||||
func (s *TestSuite) TestValidSessionID(c *C) {
|
||||
validSid := regexp.MustCompile("^[a-zA-Z]+$")
|
||||
sid := randomID(8)
|
||||
sid := newRandomID(8)
|
||||
c.Assert(len(sid), Equals, 8)
|
||||
c.Assert(validSid.MatchString(sid), Equals, true)
|
||||
}
|
||||
|
||||
+2
-2
@@ -103,7 +103,7 @@ func (sl *sortedList) Create(clnt client.Client, id string) *probe.Error {
|
||||
}
|
||||
|
||||
// List list the entries from the sorted file
|
||||
func (sl *sortedList) List(recursive bool) <-chan client.ContentOnChannel {
|
||||
func (sl sortedList) List(recursive bool) <-chan client.ContentOnChannel {
|
||||
ch := make(chan client.ContentOnChannel)
|
||||
go func() {
|
||||
defer close(ch)
|
||||
@@ -124,7 +124,7 @@ func (sl *sortedList) List(recursive bool) <-chan client.ContentOnChannel {
|
||||
}
|
||||
|
||||
// Delete close and delete the ondisk file
|
||||
func (sl *sortedList) Delete() *probe.Error {
|
||||
func (sl sortedList) Delete() *probe.Error {
|
||||
if err := sl.file.Close(); err != nil {
|
||||
return probe.NewError(err)
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ import (
|
||||
|
||||
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
|
||||
// randomID generates a random id of regular lower case and uppercase english characters
|
||||
func randomID(n int) string {
|
||||
// newRandomID generates a random id of regular lower case and uppercase english characters
|
||||
func newRandomID(n int) string {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
sid := make([]rune, n)
|
||||
for i := range sid {
|
||||
|
||||
Reference in New Issue
Block a user