Skip to content

Instantly share code, notes, and snippets.

View func25's full-sized avatar
🎯
Focusing

Phuong Le func25

🎯
Focusing
View GitHub Profile
@func25
func25 / string_buffer_perf.go
Last active January 20, 2023 02:37
Comparing between string and byte buffer in golang
package main
import (
"bytes"
"fmt"
"strings"
"time"
)
func main() {
@func25
func25 / interface_1_concrete.go
Created January 5, 2023 08:29
avoid using interface with only 1 concrete type
package main
import (
"fmt"
"time"
)
type Shape interface {
Area() float64
}
@func25
func25 / preallocate_slice.go
Created January 5, 2023 08:37
Pre-allocating slice, avoid resizing
package main
import (
"fmt"
"time"
)
func main() {
// Allocate a slice with a small capacity
start := time.Now()
@func25
func25 / custom_struct_tag.go
Created January 15, 2023 13:56
Custom struct tag in Go
package main
import (
"fmt"
"reflect"
"strconv"
"strings"
)
type Student struct {