diff --git a/bindings/group.go b/bindings/group.go index 729aac8781d24258e61a077b01ee4eb5a43baec6..a1f32b34e9c613bbb4357f6c2705ee930a7d3c01 100644 --- a/bindings/group.go +++ b/bindings/group.go @@ -64,10 +64,10 @@ func NewGroupManager(client *Client, requestFunc GroupRequestFunc, // MakeGroup creates a new group and sends a group request to all members in the // group. The ID of the new group, the rounds the requests were sent on, and the // status of the send are contained in NewGroupReport. -func (g *GroupChat) MakeGroup(membership *IdList, name, message []byte)*NewGroupReport { +func (g *GroupChat) MakeGroup(membership *IdList, name, message []byte) *NewGroupReport { grp, rounds, status, err := g.m.MakeGroup(membership.list, name, message) errStr := "" - if err !=nil{ + if err != nil { errStr = err.Error() } return &NewGroupReport{&Group{grp}, rounds, status, errStr} @@ -83,14 +83,14 @@ func (g *GroupChat) ResendRequest(groupIdBytes []byte) (*NewGroupReport, error) } grp, exists := g.m.GetGroup(groupID) - if !exists{ - return nil,errors.Errorf("Failed to find group %s", groupID) + if !exists { + return nil, errors.Errorf("Failed to find group %s", groupID) } rounds, status, err := g.m.ResendRequest(groupID) errStr := "" - if err !=nil{ + if err != nil { errStr = err.Error() } return &NewGroupReport{&Group{grp}, rounds, status, errStr}, nil @@ -166,11 +166,11 @@ type NewGroupReport struct { group *Group rounds []id.Round status gc.RequestStatus - err string + err string } type GroupReportDisk struct { - List []id.Round + List []id.Round GrpId []byte Status int } @@ -201,10 +201,9 @@ func (ngr *NewGroupReport) GetError() string { return ngr.err } - func (ngr *NewGroupReport) Marshal() ([]byte, error) { grpReportDisk := GroupReportDisk{ - List: ngr.rounds, + List: ngr.rounds, GrpId: ngr.group.GetID()[:], Status: ngr.GetStatus(), } diff --git a/interfaces/preimage/generate.go b/interfaces/preimage/generate.go index 476e6b7157c8953ac82a572e119f725c0a081475..84798d696a8b2311e6e89b01f64c885eb6c2d5b8 100644 --- a/interfaces/preimage/generate.go +++ b/interfaces/preimage/generate.go @@ -7,7 +7,7 @@ import ( func Generate(data []byte, t string) []byte { - if t==Default{ + if t == Default { return data } // Hash fingerprints diff --git a/network/manager.go b/network/manager.go index bb69e30a5154ec09e4d029d6c797171d088e01fb..c968102e2f5b04269c123c5d1b624ae7a865678a 100644 --- a/network/manager.go +++ b/network/manager.go @@ -99,10 +99,10 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard, earliest := uint64(0) // create manager object m := manager{ - param: params, - tracker: &tracker, - addrSpace: ephemeral.NewAddressSpace(), - events: events, + param: params, + tracker: &tracker, + addrSpace: ephemeral.NewAddressSpace(), + events: events, earliestRound: &earliest, } @@ -258,19 +258,18 @@ func (m *manager) GetVerboseRounds() string { return m.verboseRounds.String() } - -func (m *manager) SetFakeEarliestRound(rnd id.Round) { +func (m *manager) SetFakeEarliestRound(rnd id.Round) { atomic.StoreUint64(m.earliestRound, uint64(rnd)) } // GetFakeEarliestRound generates a random earliest round for a fake identity. -func (m *manager) GetFakeEarliestRound() id.Round { +func (m *manager) GetFakeEarliestRound() id.Round { b, err := csprng.Generate(8, rand.Reader) if err != nil { jww.FATAL.Panicf("Could not get random number: %v", err) } - rangeVal := binary.LittleEndian.Uint64(b) % 800 + rangeVal := binary.LittleEndian.Uint64(b) % 800 earliestKnown := atomic.LoadUint64(m.earliestRound)