Programming/golang2022. 9. 28. 17:16

golang이 어쩔수 없이 쓰긴 하지만 마음에 들진 않는다 정도가 현재까지 결론

 

장점.

1. 멀티플랫폼 지원.

> 리눅스건 맥이건 윈도우건 GOOS= 라는 선언 하나 주면 아주 간단하게 크로스빌드가 된다.

2. 정적 바이너리 생성(기본 값)

> 양날의 검. 물론 hello world 하나 출력하는데 2MB 정도 먹고 몇가지 모듈들을 불러오면 기하급수적으로 늘지만

> 별다른 의존성 라이브러리 없이 독립적으로 빌드해서 실행가능한 단일 파일 하나만 복사하면 되는 건

> 임베디드에서 관리의 편의성을 제공함

3. 컴파일 언어

> node.js나 python과 같이 메모리 관리 불가능(?)한 실행환경이 아닌 컴파일 된 바이너리가 실행되는 것.

> 상업 프로그램, 배포환경, 임베디드라는 조건에서는 오히려 장점

4. net/http 등과 같은 고수준 라이브러리 제공

> c로도 curl 을 쓰면 REST 구현은 가능하지만 기본 라이브러리로 푸짐하게 제공하는 golang이 편하긴 하다.

 

단점.

1. 고정된 문법. 왜 내 마음대로 괄호 위치를 못 하냐고!!!

> c로는 warning 뜰만한 것도 죄다 error로 중단되고, 사용하지 않는 변수 있다고 빌드 에러

> 게다가 if () { 식으로 마치 python 처럼 indent가 문법에서 강요되는 느낌이라 드럽게 거부감이 가시질 않음)

2. IDE 가 약함. vi로 하려면 어우.. 다 외우지 않으면 더 귀찮..

> 방대한 라이브러리를 제공하는 신형 언어들의 득과 실이긴 하지만.. vscode에서 잘 지원되려나

> 외부 라이브러리 등에 대한 자동 완성을 얼마나 지원하는지 테스트는 해봐야 할 듯.

3. npm이나 pip 같은 중앙관리 되는 라이브러리 저장소 부재

> 언어의 발달이 빠른 시기라 라이브러리 버전 문제와 엮여 구버전 소스 빌드가 쉽지 않음

> 게다가 npm 처럼 얼마나 인기있고 숙성된 라이브러리인지 간접적으로 예측할 지표가 없어서

> 매번 검색해서 누군가의 소스를 써야 하는 불안함을 지울 수 없음

4. 문서 부족. tour of go 정도로는 어림도 없다.

> effective go 정도는 봐야 하지 않나 싶은데, 그런 문서를 찾는 것 자체가 어떻게 보면 접근성 측면에서 최악.

> 꼰대가 되서(?!) html 보단 pdf로 된 걸 받고 싶은데 그런 것도 없고

> 어떤 언어를 하나 배우는데 있어서 학습 커브 상승에 상당히 일조하는 부족한 문서

5. 자동화.

> 양면의 날이긴 하지만 자동화로 인해서 자동화 돌리기 위한 구조를 알아야 하는 문제가 발생

> 부족한 문서와 음의 시너지를 일으킴. go build . 으로 빌드는 가능하지만 도대체 어떻게 묶일지

> 빌드 하려면 기본적으로 패키지 이해를 해야 한다. 근데 문서들도 자세한 설명은 없다는게 함정.

 

 

 

결론

특정 환경에서 어쩔수 없는 선택지 라는 수준의 언어. 

좋다 나쁘다를 떠나서 내 취향은 아니지만 웹 서비스를 구동하기에는 임베디드에서 이 만한 녀석은 없다는게 슬프다.

 

[링크 : https://covenant.tistory.com/204]

[링크 : https://simplear.tistory.com/8]

'Programming > golang' 카테고리의 다른 글

cgo  (0) 2022.10.04
golang unsafe package  (0) 2022.10.01
golang json/encoding marshal() unmarshal()  (0) 2022.09.28
golang mac address 얻기  (0) 2022.09.28
golang method  (0) 2022.09.27
Posted by 구차니
Programming/golang2022. 9. 28. 16:45

encoding/json 의 json.Unmarshal() 이나 json.Marshal()은 특이(?)하게도

구조체의 변수가 대문자여야 변환을 해준다.

어떤 버전이 그런 영향을 주는건진 모르겠지만.. 참고해야 할 듯..

 

package main

import (
                "net"
                //      "net/http"
                "fmt"
                "encoding/json"
        _       "io"
                "os"
       )

const conf_file = "config.json"
const server_url = "https://localhost"

type Config struct {
        Server  string
}

func main() {
        var config Config

        conf, err := os.ReadFile(conf_file)
        if err != nil {
                fmt.Println(err)
                fmt.Println("create default configuration file")

                config.Server = server_url
                jsonbyte, _ := json.Marshal(config)
                fmt.Println(config)
                fmt.Println(jsonbyte)
                os.WriteFile(conf_file, jsonbyte, 0644)
        }
        fmt.Println(conf)
        err = json.Unmarshal(conf, &config)
        fmt.Println(config)

        fmt.Println("*** Client start ***")
        temp, _ := net.InterfaceByName("enp0s25")
        mac := temp.HardwareAddr.String()
        fmt.Println(mac)
}

 

[링크 : https://www.joinc.co.kr/w/man/12/golang/json]

[링크 : https://jeonghwan-kim.github.io/dev/2019/01/18/go-encoding-json.html]

[링크 : http://golang.site/go/article/104-JSON-사용]

 

[링크 : https://pkg.go.dev/encoding/json]

'Programming > golang' 카테고리의 다른 글

golang unsafe package  (0) 2022.10.01
golang 의 장단점. 개인적인 생각  (2) 2022.09.28
golang mac address 얻기  (0) 2022.09.28
golang method  (0) 2022.09.27
go mod init 과 go build  (0) 2022.09.27
Posted by 구차니
Programming/golang2022. 9. 28. 12:03

"net" 패키지의 Interfaces() 람수를 이용하여 얻어올 수 있다.

[링크 : https://socketloop.com/tutorials/golang-get-local-ip-and-mac-address]

[링크 : https://stackoverflow.com/questions/44859156/get-permanent-mac-address]

 

HardwareAddr은 MAC address, Name에는 lo, eth 같은 장치식별자가 들어간다.

type Interface struct {
Index        int          // positive integer that starts at one, zero is never used
MTU          int          // maximum transmission unit
Name         string       // e.g., "en0", "lo0", "eth0.100"
HardwareAddr HardwareAddr // IEEE MAC-48, EUI-48 and EUI-64 form
Flags        Flags        // e.g., FlagUp, FlagLoopback, FlagMulticast
}

[링크 : https://pkg.go.dev/net#Interface]

'Programming > golang' 카테고리의 다른 글

golang 의 장단점. 개인적인 생각  (2) 2022.09.28
golang json/encoding marshal() unmarshal()  (0) 2022.09.28
golang method  (0) 2022.09.27
go mod init 과 go build  (0) 2022.09.27
golang 함수 인자에 함수 넣기  (0) 2022.09.27
Posted by 구차니
Programming/golang2022. 9. 27. 17:12

메소드라길래 먼가 해서 봤더니.. class는 없는 대신 타입 결정적인 함수를 메소드라고 정의하는 듯.

메소드의 타입을 정의하는 것을 리시버 라고 명명한다.

Methods
Go does not have classes. However, you can define methods on types.

A method is a function with a special receiver argument.

The receiver appears in its own argument list between the func keyword and the method name.

In this example, the Abs method has a receiver of type Vertex named v.
package main

import (
"fmt"
"math"
)

type Vertex struct {
X, Y float64
}

func (v Vertex) Abs() float64 {
return math.Sqrt(v.X*v.X + v.Y*v.Y)
}

func main() {
v := Vertex{3, 4}
fmt.Println(v.Abs())
}

[링크 : https://go.dev/tour/methods/1]

[링크 : https://dev-yakuza.posstree.com/ko/golang/method/]

[링크 : https://kamang-it.tistory.com/entry/Go15메소드Method와-리시버Receiver]

 

포인터를 넘길수도 있긴 하다.

[링크 : http://golang.site/go/article/17-Go-메서드]

 

'Programming > golang' 카테고리의 다른 글

golang json/encoding marshal() unmarshal()  (0) 2022.09.28
golang mac address 얻기  (0) 2022.09.28
go mod init 과 go build  (0) 2022.09.27
golang 함수 인자에 함수 넣기  (0) 2022.09.27
golang package main  (0) 2022.09.23
Posted by 구차니
Programming/golang2022. 9. 27. 16:17

먼가 복잡하다.

일단 모듈 패스는 초기 모듈/경로/패키지 명 식으로 잡히는 듯.

편리하다면 편리한데.. 직관적으로 와닫진 않는 느낌.. 그냥 .a나 .o로 빌드하고 링크 하는건 가능하려나?

 

아 그리고 go build 명령에 의해서 빌드 될 때

mod init의 가장 마지막 명칭으로 바이너리가 생성된다.

test/m 으로 패키지를 지었기에, 바이너리가 m으로 생성되었다.

 

$ tree
.
├── go.mod
├── lib
│   ├── div
│   │   └── div.go
│   └── sub
│       └── sub.go
├── m
├── main.go
└── sum
    └── sum.go
$ go build
# test/m
./main.go:5:2: imported and not used: "test/m/lib/div"
./main.go:6:2: imported and not used: "test/m/sum"
$ go mod init test/m
go: creating new go.mod: module test/m
go: to add module requirements and sums:
        go mod tidy


$ cat go.mod
module test/m

go 1.18
$ cat main.go
package main

import (
        "fmt"
        "test/m/lib/div"
        "test/m/sum"

)

func main() {
        fmt.Println("hello world")
}
$ cat lib/div/div.go
package div

func div(a float32, b float32) float32 {
        return a / b
}
$ cat sum/sum.go
package sum

func sum (a int, b int) int {

        return a + b
}

[링크 : https://www.vompressor.com/go-mod/]

'Programming > golang' 카테고리의 다른 글

golang mac address 얻기  (0) 2022.09.28
golang method  (0) 2022.09.27
golang 함수 인자에 함수 넣기  (0) 2022.09.27
golang package main  (0) 2022.09.23
golang REST client  (0) 2022.09.23
Posted by 구차니
Programming/golang2022. 9. 27. 14:22

말이 애매한데. 걍 C언어의 함수 포인터를 어떻게 사용이 가능할까 찾아보는 중.

 

package main

import (
    "fmt"
    "strings"
)

func Index(vs []string, t string) int {
    for i, v := range vs {
        if v == t {
            return i
        }
    }
    return -1
}

func Include(vs []string, t string) bool {
    return Index(vs, t) >= 0
}

func Any(vs []string, f func(string) bool) bool {
    for _, v := range vs {
        if f(v) {
            return true
        }
    }
    return false
}

func All(vs []string, f func(string) bool) bool {
    for _, v := range vs {
        if !f(v) {
            return false
        }
    }
    return true
}

func Filter(vs []string, f func(string) bool) []string {
    vsf := make([]string, 0)
    for _, v := range vs {
        if f(v) {
            vsf = append(vsf, v)
        }
    }
    return vsf
}

func Map(vs []string, f func(string) string) []string {
    vsm := make([]string, len(vs))
    for i, v := range vs {
        vsm[i] = f(v)
    }
    return vsm
}

func main() {

    var strs = []string{"peach", "apple", "pear", "plum"}

    fmt.Println(Index(strs, "pear"))

    fmt.Println(Include(strs, "grape"))

    fmt.Println(Any(strs, func(v string) bool {
        return strings.HasPrefix(v, "p")
    }))

    fmt.Println(All(strs, func(v string) bool {
        return strings.HasPrefix(v, "p")
    }))

    fmt.Println(Filter(strs, func(v string) bool {
        return strings.Contains(v, "e")
    }))

    fmt.Println(Map(strs, strings.ToUpper))

}

[링크 : https://gobyexample.com/collection-functions]

 

package main

import "fmt"

func upper(input string) string {
    return "hola"
}

func Validate(spec string, validations []func(string) string) {
    for _, exec := range validations {
        fmt.Println(exec(spec))
    }
}

func main() {
    Validate("Hola", []func(string) string{upper})
}

[링크 : https://stackoverflow.com/questions/50913022/array-of-functions-to-as-argument-in-golang]

'Programming > golang' 카테고리의 다른 글

golang method  (0) 2022.09.27
go mod init 과 go build  (0) 2022.09.27
golang package main  (0) 2022.09.23
golang REST client  (0) 2022.09.23
golang 'go doc'  (0) 2022.09.15
Posted by 구차니
Programming/golang2022. 9. 23. 15:45

main을 지정해주어야 실행가능한 바이너리로 빌드 되는 느낌.

 

// 파일 생성되지 않음
$ go build client.go

// 강제 생성
$ go build -o client client.go
$ ls -al
-rw-rw-r--  1 minimonk minimonk    7014  9월 23 15:42 client
-rw-rw-r--  1 minimonk minimonk     102  9월 23 15:41 client.go

$ file client
client: current ar archive

$ ar -t client
__.PKGDEF
_go_.o

 

빌드시 static link가 기본이라 그렇지 main 패키지가 아닌 파일은

단순 object로 빌드가 되어 용량이 적게 나온다.

'Programming > golang' 카테고리의 다른 글

go mod init 과 go build  (0) 2022.09.27
golang 함수 인자에 함수 넣기  (0) 2022.09.27
golang REST client  (0) 2022.09.23
golang 'go doc'  (0) 2022.09.15
golang main arg, getopt  (0) 2022.09.15
Posted by 구차니
Programming/golang2022. 9. 23. 15:06

 

[링크 : http://golang.site/go/article/103-HTTP-POST-호출]

 

net/http 패키지에 Get() Post() 명령등을 사용하면 간단하게 보낼수 있는 듯.

resp, err := http.Get("http://example.com/")
...
resp, err := http.Post("http://example.com/upload", "image/jpeg", &buf)
...
resp, err := http.PostForm("http://example.com/form",
	url.Values{"key": {"Value"}, "id": {"123"}})

[링크 : https://pkg.go.dev/net/http]

 

Put() Delete()는 http.NewRequest()를 이용하여 http.MethodPut / http.MethodDelete 타입으로 만들어 주면

기본 모듈로도 충분히 구현 가능한 것 같다.

func put() {
    fmt.Println("3. Performing Http Put...")
    todo := Todo{1, 2, "lorem ipsum dolor sit amet", true}
    jsonReq, err := json.Marshal(todo)
    req, err := http.NewRequest(http.MethodPut, "https://jsonplaceholder.typicode.com/todos/1", bytes.NewBuffer(jsonReq))
    req.Header.Set("Content-Type", "application/json; charset=utf-8")
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    defer resp.Body.Close()
    bodyBytes, _ := ioutil.ReadAll(resp.Body)

    // Convert response body to string
    bodyString := string(bodyBytes)
    fmt.Println(bodyString)

    // Convert response body to Todo struct
    var todoStruct Todo
    json.Unmarshal(bodyBytes, &todoStruct)
    fmt.Printf("API Response as struct:\n%+v\n", todoStruct)
}

func delete() {
    fmt.Println("4. Performing Http Delete...")
    todo := Todo{1, 2, "lorem ipsum dolor sit amet", true}
    jsonReq, err := json.Marshal(todo)
    req, err := http.NewRequest(http.MethodDelete, "https://jsonplaceholder.typicode.com/todos/1", bytes.NewBuffer(jsonReq))
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    defer resp.Body.Close()
    bodyBytes, _ := ioutil.ReadAll(resp.Body)

    // Convert response body to string
    bodyString := string(bodyBytes)
    fmt.Println(bodyString)
}

[링크 : https://www.soberkoder.com/consume-rest-api-go/]

'Programming > golang' 카테고리의 다른 글

golang 함수 인자에 함수 넣기  (0) 2022.09.27
golang package main  (0) 2022.09.23
golang 'go doc'  (0) 2022.09.15
golang main arg, getopt  (0) 2022.09.15
golang json  (0) 2022.09.15
Posted by 구차니
Programming/jquery2022. 9. 16. 14:40

ajax에서 DELETE로 하면 된다고 해서 해보는데 크롬에서 보면 자꾸 POST로 보내는 것 같기도?

아무튼.. 다시 해보니 되긴한데 머가 잘못되었던 걸까...

 

jquery 문서에는 1.9.0에 추가된 기능으로 POST GET PUT 과 같은 방법을 입력한다고 되어있는데

왜 DELETE가 언급이 안되어 있는걸까?

 

method (default: 'GET')
Type: String
The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). (version added: 1.9.0)

type (default: 'GET')
Type: String
An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0.

 [링크 : https://api.jquery.com/jquery.ajax/]

'Programming > jquery' 카테고리의 다른 글

jquery ajax auth  (0) 2023.07.27
jquery-cookie 라이브러리  (0) 2022.09.05
jquery 우클릭 가로채기  (0) 2019.06.04
jquery ajax json flask  (0) 2019.01.07
jquery this 버튼 checked  (0) 2019.01.07
Posted by 구차니
Programming/golang2022. 9. 15. 19:02

 

$ go doc os.Pipe
package os // import "os"

func Pipe() (r *File, w *File, err error)
    Pipe returns a connected pair of Files; reads from r return bytes written to
    w. It returns the files and an error, if any.

 

$ go doc os
package os // import "os"

Package os provides a platform-independent interface to operating system
functionality. The design is Unix-like, although the error handling is Go-like;
failing calls return values of type error rather than error numbers. Often, more
information is available within the error. For example, if a call that takes a
file name fails, such as Open or Stat, the error will include the failing file
name when printed and will be of type *PathError, which may be unpacked for more
information.

The os interface is intended to be uniform across all operating systems.
Features not generally available appear in the system-specific package syscall.

Here is a simple example, opening a file and reading some of it.

    file, err := os.Open("file.go") // For read access.
    if err != nil {
     log.Fatal(err)
    }

If the open fails, the error string will be self-explanatory, like

    open file.go: no such file or directory

The file's data can then be read into a slice of bytes. Read and Write take
their byte counts from the length of the argument slice.

    data := make([]byte, 100)
    count, err := file.Read(data)
    if err != nil {
     log.Fatal(err)
    }
    fmt.Printf("read %d bytes: %q\n", count, data[:count])

Note: The maximum number of concurrent operations on a File may be limited by
the OS or the system. The number should be high, but exceeding it may degrade
performance or cause other issues.

const O_RDONLY int = syscall.O_RDONLY ...
const SEEK_SET int = 0 ...
const PathSeparator = '/' ...
const ModeDir = fs.ModeDir ...
const DevNull = "/dev/null"
var ErrInvalid = fs.ErrInvalid ...
var Stdin = NewFile(uintptr(syscall.Stdin), "/dev/stdin") ...
var Args []string
var ErrProcessDone = errors.New("os: process already finished")
func Chdir(dir string) error
func Chmod(name string, mode FileMode) error
func Chown(name string, uid, gid int) error
func Chtimes(name string, atime time.Time, mtime time.Time) error
func Clearenv()
func DirFS(dir string) fs.FS
func Environ() []string
func Executable() (string, error)
func Exit(code int)
func Expand(s string, mapping func(string) string) string
func ExpandEnv(s string) string
func Getegid() int
func Getenv(key string) string
func Geteuid() int
func Getgid() int
func Getgroups() ([]int, error)
func Getpagesize() int
func Getpid() int
func Getppid() int
func Getuid() int
func Getwd() (dir string, err error)
func Hostname() (name string, err error)
func IsExist(err error) bool
func IsNotExist(err error) bool
func IsPathSeparator(c uint8) bool
func IsPermission(err error) bool
func IsTimeout(err error) bool
func Lchown(name string, uid, gid int) error
func Link(oldname, newname string) error
func LookupEnv(key string) (string, bool)
func Mkdir(name string, perm FileMode) error
func MkdirAll(path string, perm FileMode) error
func MkdirTemp(dir, pattern string) (string, error)
func NewSyscallError(syscall string, err error) error
func Pipe() (r *File, w *File, err error)
func ReadFile(name string) ([]byte, error)
func Readlink(name string) (string, error)
func Remove(name string) error
func RemoveAll(path string) error
func Rename(oldpath, newpath string) error
func SameFile(fi1, fi2 FileInfo) bool
func Setenv(key, value string) error
func Symlink(oldname, newname string) error
func TempDir() string
func Truncate(name string, size int64) error
func Unsetenv(key string) error
func UserCacheDir() (string, error)
func UserConfigDir() (string, error)
func UserHomeDir() (string, error)
func WriteFile(name string, data []byte, perm FileMode) error
type DirEntry = fs.DirEntry
    func ReadDir(name string) ([]DirEntry, error)
type File struct{ ... }
    func Create(name string) (*File, error)
    func CreateTemp(dir, pattern string) (*File, error)
    func NewFile(fd uintptr, name string) *File
    func Open(name string) (*File, error)
    func OpenFile(name string, flag int, perm FileMode) (*File, error)
type FileInfo = fs.FileInfo
    func Lstat(name string) (FileInfo, error)
    func Stat(name string) (FileInfo, error)
type FileMode = fs.FileMode
type LinkError struct{ ... }
type PathError = fs.PathError
type ProcAttr struct{ ... }
type Process struct{ ... }
    func FindProcess(pid int) (*Process, error)
    func StartProcess(name string, argv []string, attr *ProcAttr) (*Process, error)
type ProcessState struct{ ... }
type Signal interface{ ... }
    var Interrupt Signal = syscall.SIGINT ...
type SyscallError struct{ ... }

 

 

$ go help
Go is a tool for managing Go source code.

Usage:

go <command> [arguments]

The commands are:

bug         start a bug report
build       compile packages and dependencies
clean       remove object files and cached files
doc         show documentation for package or symbol

 

$ go help doc
usage: go doc [doc flags] [package|[package.]symbol[.methodOrField]]

Doc prints the documentation comments associated with the item identified by its
arguments (a package, const, func, type, var, method, or struct field)
followed by a one-line summary of each of the first-level items "under"
that item (package-level declarations for a package, methods for a type,
etc.).

Doc accepts zero, one, or two arguments.

Given no arguments, that is, when run as

go doc

it prints the package documentation for the package in the current directory.
If the package is a command (package main), the exported symbols of the package
are elided from the presentation unless the -cmd flag is provided.

When run with one argument, the argument is treated as a Go-syntax-like
representation of the item to be documented. What the argument selects depends
on what is installed in GOROOT and GOPATH, as well as the form of the argument,
which is schematically one of these:

go doc <pkg>
go doc <sym>[.<methodOrField>]
go doc [<pkg>.]<sym>[.<methodOrField>]
go doc [<pkg>.][<sym>.]<methodOrField>

The first item in this list matched by the argument is the one whose documentation
is printed. (See the examples below.) However, if the argument starts with a capital
letter it is assumed to identify a symbol or method in the current directory.

For packages, the order of scanning is determined lexically in breadth-first order.
That is, the package presented is the one that matches the search and is nearest
the root and lexically first at its level of the hierarchy. The GOROOT tree is
always scanned in its entirety before GOPATH.

If there is no package specified or matched, the package in the current
directory is selected, so "go doc Foo" shows the documentation for symbol Foo in
the current package.

The package path must be either a qualified path or a proper suffix of a
path. The go tool's usual package mechanism does not apply: package path
elements like . and ... are not implemented by go doc.

When run with two arguments, the first is a package path (full path or suffix),
and the second is a symbol, or symbol with method or struct field:

go doc <pkg> <sym>[.<methodOrField>]

In all forms, when matching symbols, lower-case letters in the argument match
either case but upper-case letters match exactly. This means that there may be
multiple matches of a lower-case argument in a package if different symbols have
different cases. If this occurs, documentation for all matches is printed.

Examples:
go doc
Show documentation for current package.
go doc Foo
Show documentation for Foo in the current package.
(Foo starts with a capital letter so it cannot match
a package path.)
go doc encoding/json
Show documentation for the encoding/json package.
go doc json
Shorthand for encoding/json.
go doc json.Number (or go doc json.number)
Show documentation and method summary for json.Number.
go doc json.Number.Int64 (or go doc json.number.int64)
Show documentation for json.Number's Int64 method.
go doc cmd/doc
Show package docs for the doc command.
go doc -cmd cmd/doc
Show package docs and exported symbols within the doc command.
go doc template.new
Show documentation for html/template's New function.
(html/template is lexically before text/template)
go doc text/template.new # One argument
Show documentation for text/template's New function.
go doc text/template new # Two arguments
Show documentation for text/template's New function.

At least in the current tree, these invocations all print the
documentation for json.Decoder's Decode method:

go doc json.Decoder.Decode
go doc json.decoder.decode
go doc json.decode
cd go/src/encoding/json; go doc decode

Flags:
-all
Show all the documentation for the package.
-c
Respect case when matching symbols.
-cmd
Treat a command (package main) like a regular package.
Otherwise package main's exported symbols are hidden
when showing the package's top-level documentation.
-short
One-line representation for each symbol.
-src
Show the full source code for the symbol. This will
display the full Go source of its declaration and
definition, such as a function definition (including
the body), type declaration or enclosing const
block. The output may therefore include unexported
details.
-u
Show documentation for unexported as well as exported
symbols, methods, and fields.

'Programming > golang' 카테고리의 다른 글

golang package main  (0) 2022.09.23
golang REST client  (0) 2022.09.23
golang main arg, getopt  (0) 2022.09.15
golang json  (0) 2022.09.15
golang ini  (0) 2022.09.15
Posted by 구차니