Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gofmt #965

Merged
merged 1 commit into from
May 8, 2024
Merged

gofmt #965

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<br/>

[![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/nknorg/nkn)](https://goreportcard.com/report/github.com/nknorg/nkn) [![Build Status](https://github.com/nknorg/nkn/actions/workflows/build-ubuntu.yml/badge.svg)](https://github.com/nknorg/nkn/actions/workflows/build-ubuntu.yml) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing)
[![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/nknorg/nkn/v2)](https://goreportcard.com/report/github.com/nknorg/nkn/v2) [![Build Status](https://github.com/nknorg/nkn/actions/workflows/build-ubuntu.yml/badge.svg)](https://github.com/nknorg/nkn/actions/workflows/build-ubuntu.yml) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing)

### Dev Status: V2 line, Production (Stable and Feature-Complete)

Expand Down
2 changes: 1 addition & 1 deletion api/websocket/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (ms *MsgServer) registryMethod() {
err = crypto.Verify(pubKey, hash[:], byteSignature)
if err != nil { // fail verify challenge signature
go func() {
log.Warning("Client signature is not right, close its conneciton now")
log.Warning("Client signature is not right, close its connection now")
time.Sleep(3 * time.Second) // sleep several second, let response reach client
ms.SessionList.CloseSession(sess) // close this session
}()
Expand Down
2 changes: 1 addition & 1 deletion common/serialization/serialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
var ErrRange = errors.New("value out of range")
var ErrEof = errors.New("got EOF, can not get the next byte")

//SerializableData describe the data need be serialized.
// SerializableData describe the data need be serialized.
type SerializableData interface {

//Write data to writer
Expand Down
2 changes: 1 addition & 1 deletion dashboard/routes/common/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package common

import (
"github.com/gin-gonic/gin"
serviceConfig "github.com/nknorg/nkn/v2/dashboard/config"
"github.com/nknorg/nkn/v2/config"
serviceConfig "github.com/nknorg/nkn/v2/dashboard/config"
"net/http"
"time"
)
Expand Down
2 changes: 1 addition & 1 deletion dashboard/routes/node/beneficiary.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package node
import (
"encoding/json"
"github.com/gin-gonic/gin"
"github.com/nknorg/nkn/v2/config"
"github.com/nknorg/nkn/v2/dashboard/auth"
"github.com/nknorg/nkn/v2/dashboard/helpers"
"github.com/nknorg/nkn/v2/config"
"github.com/nknorg/nkn/v2/util/log"
"net/http"
)
Expand Down
2 changes: 1 addition & 1 deletion dashboard/routes/wallet/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"net/http"

"github.com/gin-gonic/gin"
"github.com/nknorg/nkn/v2/config"
serviceConfig "github.com/nknorg/nkn/v2/dashboard/config"
"github.com/nknorg/nkn/v2/dashboard/helpers"
"github.com/nknorg/nkn/v2/config"
"github.com/nknorg/nkn/v2/util/log"
"github.com/nknorg/nkn/v2/util/password"
"github.com/nknorg/nkn/v2/vault"
Expand Down
4 changes: 2 additions & 2 deletions pb/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/nknorg/nkn/v2/common/serialization"
)

//Serialize the Program
// Serialize the Program
func (p *Program) Serialize(w io.Writer) error {
err := serialization.WriteVarBytes(w, p.Parameter)
if err != nil {
Expand All @@ -24,7 +24,7 @@ func (p *Program) Serialize(w io.Writer) error {
return nil
}

//Deserialize the Program
// Deserialize the Program
func (p *Program) Deserialize(w io.Reader) error {
val, err := serialization.ReadVarBytes(w)
if err != nil {
Expand Down
18 changes: 9 additions & 9 deletions program/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func ByteToProgramContextParameterType(b []byte) []ProgramContextParameterType {
return c
}

//create a single signature program context for owner
// create a single signature program context for owner
func CreateSignatureProgramContext(ownerPubKey []byte) (*ProgramContext, error) {
code, err := CreateSignatureProgramCode(ownerPubKey)
if err != nil {
Expand All @@ -121,7 +121,7 @@ func CreateSignatureProgramContext(ownerPubKey []byte) (*ProgramContext, error)
}, nil
}

//CODE: len(publickey) + publickey + CHECKSIG
// CODE: len(publickey) + publickey + CHECKSIG
func CreateSignatureProgramCode(pubKey []byte) ([]byte, error) {
code := bytes.NewBuffer(nil)
code.WriteByte(byte(len(pubKey)))
Expand All @@ -144,9 +144,9 @@ func CreateProgramHash(pubKey []byte) (common.Uint160, error) {
return programHash, err
}

//CODE: len(publickey) + publickey + CHECKSIG
//--------------------------------------------
//Size: 1 32 1
// CODE: len(publickey) + publickey + CHECKSIG
// --------------------------------------------
// Size: 1 32 1
func GetPublicKeyFromCode(code []byte) ([]byte, error) {
if len(code) != 34 {
return nil, fmt.Errorf("code length error, need 34, but got %v", len(code))
Expand All @@ -159,9 +159,9 @@ func GetPublicKeyFromCode(code []byte) ([]byte, error) {
return code[1:33], nil
}

//Parameter: len(signature) + signature
//--------------------------------------------
//Size: 1 64
// Parameter: len(signature) + signature
// --------------------------------------------
// Size: 1 64
func GetSignatureFromParameter(parameter []byte) ([]byte, error) {
if len(parameter) != 65 {
return nil, fmt.Errorf("parameter length error, need 65,but got %v", len(parameter))
Expand All @@ -174,7 +174,7 @@ func GetSignatureFromParameter(parameter []byte) ([]byte, error) {
return parameter[1:], nil
}

//Parameter: len(signature) + signature
// Parameter: len(signature) + signature
func (c *ProgramContext) NewProgram(signature []byte) *pb.Program {
size := len(signature)
parameter := append([]byte{byte(size)}, signature...)
Expand Down
2 changes: 1 addition & 1 deletion signature/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/nknorg/nkn/v2/pb"
)

//SignableData describe the data need be signed.
// SignableData describe the data need be signed.
type SignableData interface {
GetProgramHashes() ([]common.Uint160, error)
SetPrograms([]*pb.Program)
Expand Down
2 changes: 1 addition & 1 deletion signature/signer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package signature

//Signer is the abstract interface of user's information(Keys) for signing data.
// Signer is the abstract interface of user's information(Keys) for signing data.
type Signer interface {
PrivKey() []byte
PubKey() []byte
Expand Down
Loading