mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Fix comments according to best practices by effective go (#219)
This commit is contained in:
committed by
Adrian Gallagher
parent
52609827eb
commit
05f9f40723
@@ -404,7 +404,7 @@ func TestTrimString(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// ReplaceString replaces a string with another
|
||||
// TestReplaceString replaces a string with another
|
||||
func TestReplaceString(t *testing.T) {
|
||||
t.Parallel()
|
||||
currency := "BTC-USD"
|
||||
|
||||
@@ -202,7 +202,7 @@ func TestNewCurrencyPairDelimiter(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// NewCurrencyPairFromIndex returns a CurrencyPair via a currency string and
|
||||
// TestNewCurrencyPairFromIndex returns a CurrencyPair via a currency string and
|
||||
// specific index
|
||||
func TestNewCurrencyPairFromIndex(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -126,7 +126,7 @@ func (e *Event) ExecuteAction() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// EventToString turns the structure event into a string
|
||||
// String turns the structure event into a string
|
||||
func (e *Event) String() string {
|
||||
condition := common.SplitStrings(e.Condition, ",")
|
||||
return fmt.Sprintf(
|
||||
|
||||
@@ -407,7 +407,7 @@ func (b *Bitflyer) GetFee(feeBuilder exchange.FeeBuilder) (float64, error) {
|
||||
return fee, nil
|
||||
}
|
||||
|
||||
// getDepositFee returns fee when performing a trade
|
||||
// calculateTradingFee returns fee when performing a trade
|
||||
func calculateTradingFee(purchasePrice float64, amount float64) float64 {
|
||||
fee := 0.0015
|
||||
// bitflyer has fee tiers, but does not disclose them via API, so the largest has to be assumed
|
||||
|
||||
@@ -592,7 +592,7 @@ func (b *Bithumb) GetFee(feeBuilder exchange.FeeBuilder) (float64, error) {
|
||||
return fee, nil
|
||||
}
|
||||
|
||||
// getDepositFee returns fee when performing a trade
|
||||
// calculateTradingFee returns fee when performing a trade
|
||||
func calculateTradingFee(purchasePrice float64, amount float64) float64 {
|
||||
fee := 0.0015
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ func (n *Nonce) Set(val int64) {
|
||||
n.mtx.Unlock()
|
||||
}
|
||||
|
||||
// Returns a string version of the nonce
|
||||
// String returns a string version of the nonce
|
||||
func (n *Nonce) String() string {
|
||||
n.mtx.Lock()
|
||||
result := strconv.FormatInt(n.n, 10)
|
||||
|
||||
@@ -423,7 +423,7 @@ func getInternationalBankWithdrawalFee(currency string, amount float64, bankTran
|
||||
return fee
|
||||
}
|
||||
|
||||
// No real fees for yobit deposits, but want to be explicit on what each payment type supports
|
||||
// getInternationalBankDepositFee; No real fees for yobit deposits, but want to be explicit on what each payment type supports
|
||||
func getInternationalBankDepositFee(currency string, amount float64, bankTransactionType exchange.InternationalBankTransactionType) float64 {
|
||||
var fee float64
|
||||
switch bankTransactionType {
|
||||
|
||||
@@ -267,7 +267,7 @@ func getPercentage(input map[string]float64, target string, totals map[string]fl
|
||||
return percentage
|
||||
}
|
||||
|
||||
// getPercentage returns the percentage a specific value of a target coin amount
|
||||
// getPercentageSpecific returns the percentage a specific value of a target coin amount
|
||||
// against the total coin amount.
|
||||
func getPercentageSpecific(input float64, target string, totals map[string]float64) float64 {
|
||||
total, _ := totals[target]
|
||||
|
||||
@@ -142,7 +142,7 @@ func main() {
|
||||
fmt.Println("\nTool finished")
|
||||
}
|
||||
|
||||
// Iterates through codebase paths to check for readme files and either adds
|
||||
// updateReadme iterates through codebase paths to check for readme files and either adds
|
||||
// or replaces with new readme files.
|
||||
func updateReadme() error {
|
||||
addPaths()
|
||||
@@ -181,7 +181,7 @@ func updateReadme() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Adds paths to different potential README.md files in the codebase
|
||||
// addPaths adds paths to different potential README.md files in the codebase
|
||||
func addPaths() {
|
||||
codebasePaths["common"] = fmt.Sprintf(commonPath, path, path, path)
|
||||
|
||||
@@ -288,7 +288,7 @@ func getCapital(name string) string {
|
||||
return cap + last
|
||||
}
|
||||
|
||||
// returns a string for godoc package names
|
||||
// getslashFromName returns a string for godoc package names
|
||||
func getslashFromName(packageName string) string {
|
||||
if strings.Contains(packageName, " ") {
|
||||
s := strings.Split(packageName, " ")
|
||||
@@ -315,7 +315,7 @@ var globS = []string{
|
||||
fmt.Sprintf("web_templates%s*", common.GetOSPathSlash()),
|
||||
}
|
||||
|
||||
// adds all the template files
|
||||
// addTemplates adds all the template files
|
||||
func addTemplates() error {
|
||||
tmpl = template.New("")
|
||||
|
||||
@@ -338,7 +338,7 @@ func checkReadme(packageName string) bool {
|
||||
return os.IsNotExist(err)
|
||||
}
|
||||
|
||||
// replaces readme file
|
||||
// replaceReadme replaces readme file
|
||||
func replaceReadme(packageName string) error {
|
||||
if packageName == licenseName || packageName == contributorName {
|
||||
if err := deleteFile(codebasePaths[packageName] + packageName); err != nil {
|
||||
@@ -352,7 +352,7 @@ func replaceReadme(packageName string) error {
|
||||
return createReadme(packageName)
|
||||
}
|
||||
|
||||
// creates new readme file and executes template
|
||||
// createReadme creates new readme file and executes template
|
||||
func createReadme(packageName string) error {
|
||||
if packageName == licenseName || packageName == contributorName {
|
||||
file, err := os.Create(codebasePaths[packageName] + packageName)
|
||||
|
||||
Reference in New Issue
Block a user