고랭(9)
-
golang - Package json
import "encoding/json"json 패키지는 RFC 4627에 정의 된 JSON의 인코딩 및 디코딩을 구현합니다. JSON 및 Go 값 간의 매핑은 marshal 및 unmarshal 함수에 대한 설명서에 설명되어 있습니다.func Marshal(v interface{}) ([]byte, error)Marshal은 v의 JSON 인코딩을 반환합니다. Marshal은 값 v를 재귀적으로 호출한다. 발생한 값이 Marshal 인터페이스를 구현하고 nil 포인터가 아닌 경우 MarshalJSON 메서드를 호출하여 JSON을 생성합니다. MarshalJSON 메서드가 없지만 값이 encoding.TextMarshaler를 대신 구현하면 Marshal은 해당 MarshalText 메서드를 호출하고 결..
2018.02.09 -
valid 시 non zero value required 오류
func checkRequired(v reflect.Value, t reflect.StructField, options tagOptionsMap) (bool, error) { if requiredOption, isRequired := options["required"]; isRequired { if len(requiredOption) > 0 { return false, Error{t.Name, fmt.Errorf(requiredOption), true} } return false, Error{t.Name, fmt.Errorf("non zero value required"), false} } else if _, isOptional := options["optional"]; fieldsRequiredByDe..
2018.02.02 -
go lang을 해보자.
링크를 통해 OS에 맞는 것을 다운 받는다. (https://golang.org/dl/)home에서 go dir를 하나 만들어준다.다운 받은 pkg를 클릭클릭 하여 셋팅해준다..bash_profile에 환경변수를 잡아준다. # GOPATH export GOPATH=$HOME/go PATH=${PATH}:/usr/local/go/bin:${GOPATH}/bin 5. go 라는 명령어를 통해 잘 깔렸는지 확인.Go is a tool for managing Go source code. Usage: go command [arguments] The commands are: build compile packages and dependenciesclean remove object filesdoc show docume..
2017.02.03