This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
var total int | |
func Square(x int) int { | |
return x * x | |
} | |
func SquareOfSum(x, y int) int { | |
z := Square(x + y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
type user struct { | |
name string | |
email string | |
} | |
func main() { | |
u1 := createUserV1() | |
u2 := createUserV2() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package statistic | |
import ( | |
"fmt" | |
) | |
func ExampleMean() { | |
numbers := []int64{1, 2, 3, 4, 5} | |
mean := Mean(numbers) | |
fmt.Println(mean) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func BenchmarkPrintWeather(b *testing.B) { | |
b.RunParallel(func(pb *testing.PB) { | |
for pb.Next() { | |
PrintWeather(90001) | |
} | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func BenchmarkSendFeedBack(b *testing.B) { | |
b.StopTimer() | |
ctx := context.Background() | |
feedback := Feedback{ | |
ReasonCode: "1", | |
Source: "search", | |
UserId: "100", | |
Data: []FeedbackDetail{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pkg | |
import ( | |
"bytes" | |
"testing" | |
"text/template" | |
) | |
func BenchmarkExample(b *testing.B) { | |
temp, _ := template.New("").Parse("Hello, Go!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pack_test | |
import ( | |
"testing" | |
"github.com/epenjehem/numbers" | |
) | |
import "testing" | |
func TestCanAddNumbers(t *testing.T) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"reflect" | |
"testing/quick" | |
"time" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"reflect" | |
"testing/quick" | |
"time" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"reflect" | |
"testing/quick" | |
"time" | |
) |
NewerOlder