golangkorea / devfest2020-golang-community-qna

평소 궁금했던 Go와 관련된 질문들을 커뮤니티 멤버들과 함께 주고 받아요!
https://gdg.community.dev/events/details/google-gdg-golang-korea-presents-devfest-korea-2020-golang-community-qa/
14 stars 0 forks source link

[vscode] debugger console input #11

Closed parkgang closed 3 years ago

parkgang commented 3 years ago

Description

안녕하세요. vscode로 golang 개발 중 debugger 상태에서는 input이 안 된다고 합니다.

다른 방법을 찾아보니 console에 attach 해서 사용하는 방법이 있다고 합니다.

이보다 더 좋은 방법을 알고 계신 분이 있다면 공유부탁드립니다.

Source code

package main

import (
    "bufio"
    "fmt"
    "os"
)

func main() {
    fmt.Print("Enter a grade: ")
    reader := bufio.NewReader(os.Stdin)
    input, _ := reader.ReadString('\n')
    fmt.Print(input)
    fmt.Println("End")
}

레퍼런스