Skip to content

Instantly share code, notes, and snippets.

View xvbnm48's full-sized avatar
🇯🇵
Golang addict and weebo

M Fariz Wisnu prananda xvbnm48

🇯🇵
Golang addict and weebo
View GitHub Profile
@xvbnm48
xvbnm48 / struct.go
Created March 6, 2022 15:14
struct example in golang
package main
import "fmt"
type Student struct {
ID string
Name string
Age int
Email string
}
@xvbnm48
xvbnm48 / method.go
Created March 6, 2022 15:25
method in golang
package main
import "fmt"
// struct
type Student struct {
ID string
Name string
Age int
Email string
@xvbnm48
xvbnm48 / package_public.go
Created March 7, 2022 16:20
package public
package management
type Idol struct {
Name string
Age int
Email string
}
package main
import (
"fmt"
"math"
"github.com/xvbnm48/golang-fundamental-kw/part5/management"
)
func main() {
package main
import (
"fmt"
"math"
"github.com/xvbnm48/golang-fundamental-kw/part5/management"
)
type hitung interface {
package main
import "fmt"
func main() {
var nomorA int = 48
var nomorB *int = &nomorA
fmt.Println("address dari nomor a pada nomorb ", nomorB)
fmt.Println("nilai dari nomor a pada nomorb ", *nomorB)
@xvbnm48
xvbnm48 / method_pointer.go
Created March 8, 2022 15:04
method pointer
package main
import "fmt"
type Gamer struct {
Name string
Games []string
}
func (game *Gamer) AddGame(nama string) {
package main
import (
"errors"
"fmt"
"strconv"
"strings"
)
func main(){
package main
import (
"errors"
"fmt"
"strconv"
"strings"
)
func validate(input string) (bool, error) {
package main
import (
"errors"
"fmt"
"strings"
)
func validate(input string) (bool, error) {
if strings.TrimSpace(input) == "" {