Skip to content

Commit

Permalink
fix: referral store messages update
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Dec 19, 2023
1 parent 02f38f0 commit 3ec768b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions discord/referral.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type ReferralStore struct {
func LoadReferralData(cfg *config.Config) (*ReferralStore, error) {
file, err := os.ReadFile(cfg.ReferralDataPath)
if err != nil {
log.Printf("error loading validator data: %v", err)
log.Printf("error loading referral data: %v", err)
return nil, fmt.Errorf("error loading data file: %w", err)
}
if len(file) == 0 {
Expand All @@ -39,8 +39,8 @@ func LoadReferralData(cfg *config.Config) (*ReferralStore, error) {

data, err := unmarshalReferralJSON(file)
if err != nil {
log.Printf("error unmarshalling validator data: %v", err)
return nil, fmt.Errorf("error unmarshalling validator data: %w", err)
log.Printf("error unmarshalling referral data: %v", err)
return nil, fmt.Errorf("error unmarshalling referral data: %w", err)
}
rs := &ReferralStore{
syncMap: data,
Expand All @@ -60,8 +60,8 @@ func (rs *ReferralStore) NewReferral(discordId, discordName, referralCode string
// save record
data, err := marshaReferralJSON(rs.syncMap)
if err != nil {
log.Printf("error marshalling validator data file: %v", err)
return fmt.Errorf("error marshalling validator data file: %w", err)
log.Printf("error marshalling referral data file: %v", err)
return fmt.Errorf("error marshalling referral data file: %w", err)
}
if err := os.WriteFile(rs.cfg.ReferralDataPath, data, 0o600); err != nil {
log.Printf("failed to write to %s: %v", rs.cfg.ReferralDataPath, err)
Expand Down Expand Up @@ -106,7 +106,7 @@ func (rs *ReferralStore) AddPoint(code string) bool {
// save record

Check failure on line 106 in discord/referral.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default (gci)
data, err := marshaReferralJSON(rs.syncMap)
if err != nil {
log.Printf("error marshalling validator data file: %v", err)
log.Printf("error marshalling referral data file: %v", err)
return false
}

Expand Down

0 comments on commit 3ec768b

Please sign in to comment.