Skip to content

Instantly share code, notes, and snippets.

@yulintan
yulintan / export_test.go
Last active November 16, 2023 10:10
It provides a way for testing private function in Go
package service
var CalculateSum = calculateSum
@yulintan
yulintan / service.go
Last active August 26, 2019 20:50
Flatten array
package service
import "errors"
func FlatternArray(a interface{}, existing []int) ([]int, error) {
switch val := a.(type) {
case int:
return append(existing, val), nil
case []int:
return append(existing, val...), nil