mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Remove some unnecessary type conversions (#841)
* Remove some unnecessary type conversions Signed-off-by: Chris Cummer <chriscummer@me.com> * Tidy'd go.mod Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -5,10 +5,11 @@ This is a demo bargraph that just populates some random date/val data
|
||||
*/
|
||||
|
||||
import (
|
||||
"github.com/rivo/tview"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/rivo/tview"
|
||||
|
||||
"github.com/wtfutil/wtf/view"
|
||||
)
|
||||
|
||||
@@ -44,7 +45,7 @@ func MakeGraph(widget *Widget) {
|
||||
|
||||
barTime := time.Now()
|
||||
for i := 0; i < lineCount; i++ {
|
||||
barTime = barTime.Add(time.Duration(time.Minute))
|
||||
barTime = barTime.Add(time.Minute)
|
||||
|
||||
bar := view.Bar{
|
||||
Label: barTime.Format("15:04"),
|
||||
|
||||
@@ -96,7 +96,7 @@ func (widget *Widget) updateSummary() {
|
||||
}()
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: time.Duration(5 * time.Second),
|
||||
Timeout: 5 * time.Second,
|
||||
}
|
||||
|
||||
for _, baseCurrency := range widget.summaryList.items {
|
||||
|
||||
@@ -111,7 +111,7 @@ func (widget *Widget) updateCurrencies() {
|
||||
)
|
||||
|
||||
client = http.Client{
|
||||
Timeout: time.Duration(5 * time.Second),
|
||||
Timeout: 5 * time.Second,
|
||||
}
|
||||
|
||||
request := makeRequest(fromCurrency)
|
||||
|
||||
@@ -74,7 +74,7 @@ func (widget *Widget) updateData() {
|
||||
}()
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: time.Duration(5 * time.Second),
|
||||
Timeout: 5 * time.Second,
|
||||
}
|
||||
|
||||
for _, fromCurrency := range widget.list.items {
|
||||
|
||||
@@ -66,12 +66,10 @@ func wifiInfo() string {
|
||||
}
|
||||
|
||||
func wifiNameLinux() string {
|
||||
cmd, _ := exec.Command("iwgetid", "-r").Output()
|
||||
return string(cmd)
|
||||
cmd, _ := exec.Command("iwgetid", "-r").Output()
|
||||
return string(cmd)
|
||||
}
|
||||
|
||||
|
||||
|
||||
func wifiNameMacOS() string {
|
||||
name := utils.FindMatch(`s*SSID: (.+)s*`, wifiInfo())
|
||||
return matchStr(name)
|
||||
@@ -103,7 +101,7 @@ func parseWlanNetsh(target string) string {
|
||||
splits := strings.Split(string(out), "\n")
|
||||
var words []string
|
||||
for _, line := range splits {
|
||||
token := strings.Split(string(line), ":")
|
||||
token := strings.Split(line, ":")
|
||||
for _, word := range token {
|
||||
words = append(words, strings.TrimSpace(word))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user