DrawingProcess
๋“œํ”„ DrawingProcess
DrawingProcess
์ „์ฒด ๋ฐฉ๋ฌธ์ž
์˜ค๋Š˜
์–ด์ œ
ยซ   2025/05   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
  • ๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ (964)
    • Profile & Branding (22)
      • Career (15)
    • IT Trends (254)
      • Conference, Faire (Experien.. (31)
      • News (187)
      • Youtube (19)
      • TED (8)
      • Web Page (2)
      • IT: Etc... (6)
    • Contents (97)
      • Book (66)
      • Lecture (31)
    • Project Process (94)
      • Ideation (0)
      • Study Report (34)
      • Challenge & Award (22)
      • 1Day1Process (5)
      • Making (5)
      • KRC-FTC (Team TC(5031, 5048.. (10)
      • GCP (GlobalCitizenProject) (15)
    • Study: ComputerScience(CS) (72)
      • CS: Basic (9)
      • CS: Database(SQL) (5)
      • CS: Network (14)
      • CS: OperatingSystem (3)
      • CS: Linux (39)
      • CS: Etc... (2)
    • Study: Software(SW) (95)
      • SW: Language (29)
      • SW: Algorithms (1)
      • SW: DataStructure & DesignP.. (1)
      • SW: Opensource (15)
      • SW: Error Bug Fix (43)
      • SW: Etc... (6)
    • Study: Artificial Intellige.. (149)
      • AI: Research (1)
      • AI: 2D Vision(Det, Seg, Tra.. (35)
      • AI: 3D Vision (70)
      • AI: MultiModal (3)
      • AI: SLAM (0)
      • AI: Light Weight(LW) (3)
      • AI: Data Pipeline (7)
      • AI: Machine Learning(ML) (1)
    • Study: Robotics(Robot) (33)
      • Robot: ROS(Robot Operating .. (9)
      • Robot: Positioning (8)
      • Robot: Planning & Control (7)
    • Study: DeveloperTools(DevTo.. (83)
      • DevTool: Git (12)
      • DevTool: CMake (13)
      • DevTool: NoSQL(Elastic, Mon.. (25)
      • DevTool: Container (17)
      • DevTool: IDE (11)
      • DevTool: CloudComputing (4)
    • ์ธ์ƒ์„ ์‚ด๋ฉด์„œ (64)
      • ๋‚˜์˜ ์ทจ๋ฏธ๋“ค (7)
      • ๋‚˜์˜ ์ƒ๊ฐ๋“ค (42)
      • ์—ฌํ–‰์„ ๋– ๋‚˜์ž~ (10)
      • ๋ถ„๊ธฐ๋ณ„ ํšŒ๊ณ  (5)

๊ฐœ๋ฐœ์ž ๋ช…์–ธ

โ€œ ๋งค์ฃผ ๋ชฉ์š”์ผ๋งˆ๋‹ค ๋‹น์‹ ์ด ํ•ญ์ƒ ํ•˜๋˜๋Œ€๋กœ ์‹ ๋ฐœ๋ˆ์„ ๋ฌถ์œผ๋ฉด ์‹ ๋ฐœ์ด ํญ๋ฐœํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ•ด๋ณด๋ผ.
์ปดํ“จํ„ฐ๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ๋Š” ์ด๋Ÿฐ ์ผ์ด ํ•ญ์ƒ ์ผ์–ด๋‚˜๋Š”๋ฐ๋„ ์•„๋ฌด๋„ ๋ถˆํ‰ํ•  ์ƒ๊ฐ์„ ์•ˆ ํ•œ๋‹ค. โ€

- Jef Raskin

๋งฅ์˜ ์•„๋ฒ„์ง€ - ์• ํ”Œ์ปดํ“จํ„ฐ์˜ ๋งคํ‚จํ† ์‹œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ฃผ๋„

์ธ๊ธฐ ๊ธ€

์ตœ๊ทผ ๊ธ€

์ตœ๊ทผ ๋Œ“๊ธ€

ํ‹ฐ์Šคํ† ๋ฆฌ

hELLO ยท Designed By ์ •์ƒ์šฐ.
DrawingProcess

๋“œํ”„ DrawingProcess

[IDE] VSCode Golang ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ • (feat. ChatGPT, HTTP/2)
Study: DeveloperTools(DevTool)/DevTool: IDE

[IDE] VSCode Golang ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ • (feat. ChatGPT, HTTP/2)

2023. 2. 16. 12:12
๋ฐ˜์‘ํ˜•
๐Ÿ’ก ๋ณธ ๋ฌธ์„œ๋Š”๋ณธ ๋ฌธ์„œ๋Š” 'VSCode Golang ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ • (ChatGPT, HTTP/2)'์— ๋Œ€ํ•ด ์ •๋ฆฌํ•ด๋†“์€ ๊ธ€์ž…๋‹ˆ๋‹ค.
Golang์— ๊ณต๋ถ€ํ•˜๊ธฐ์— ์•ž์„œ Macbook M1์—์„œ ๊ฐœ๋ฐœํ™˜๊ฒฝ์„ ์„ค์ •ํ•˜๋Š” ๊ณผ์ •์„ ์ •๋ฆฌํ•˜์˜€์œผ๋ฉฐ, ์ถ”๊ฐ€๋กœ ChatGPT๋ฅผ ํ™œ์šฉํ•˜์—ฌ HTTP/2 client, server ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜์—ฌ ํ…Œ์ŠคํŠธํ•ด๋ณด์•˜์œผ๋‹ˆ ์ฐธ๊ณ ํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

1. Go ํ™˜๊ฒฝ ์„ค์ • ๋ฐ ์„ค์น˜

ChatGPT์— ๋ฌผ์–ด๋ณธ Go lang ํ™˜๊ฒฝ ์„ค์ •

๋จผ์ € ChatGPT์—๊ฒŒ ๋ฌผ์–ด๋ณธ Go ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ • ๋ฐ ์„ค์น˜ ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ๊ฐ„๋‹จํžˆ ๋ฌผ์–ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.

๊ทธ ๊ฒฐ๊ณผ... ์ •๋ง ์ž์„ธํžˆ ์•Œ๋ ค์ฃผ๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๋‹ต๋ณ€์€ ๋‹ค์Œ๊ณผ ๊ฐ™์•˜์Šต๋‹ˆ๋‹ค.


To set up a Go project environment, you can follow these steps:

Install Go on your system. You can download and install the latest version of Go from the official Go website: https://golang.org/dl/.

Choose a directory for your project and create a new directory for your Go code. For example, you can create a directory called myproject and a subdirectory called src:

mkdir myproject 
cd myproject 
mkdir src

Set your Go workspace directory to the myproject directory by setting the GOPATH environment variable. For example, if you are using a Bash shell on Linux or macOS, you can add the following line to your .bashrc or .bash_profile file:

export GOPATH=/path/to/myproject

Replace /path/to/myproject with the path to your myproject directory.

Add the bin directory to your system's PATH environment variable so that you can run executables from your Go projects. For example, you can add the following line to your .bashrc or .bash_profile file:

export PATH=$PATH:$GOPATH/bin

Create a new Go module for your project using the go mod init command. For example, you can create a module called example.com/myproject:

cd src 
go mod init example.com/myproject

This command creates a new go.mod file in your project directory, which specifies the dependencies for your project.

Create your Go code in the src directory. For example, you can create a file called main.go:

package main 
import "fmt" 
func main() { 
	fmt.Println("Hello, world!") 
}

Build and run your Go code using the go build and go run commands:

go build ./myproject 
# on Unix-like systems myproject.exe 
# on Windows 

# or 
go run main.go

These commands compile and run your Go code. The go build command creates an executable file in the current directory, which you can run to execute your code. The go run command compiles and runs your code in memory without creating an executable file.

That's it! You now have a working Go project environment. You can add more Go code to your project by creating new files in the src directory, and you can use the go get command to install and manage external dependencies.


์‚ฌ์‹ค ChatGPT๊ฐ€ ๋ฌผ์–ด๋ณด๊ธฐ ์ „์— ์ด๋ฏธ ๋‹ค ๊ฒฝํ—˜์„ ํ•ด๋ณธ ์ƒํƒœ์˜€๋Š”๋ฐ, ์ •๋ง ๊น”๋”ํ•˜๊ฒŒ ์ •๋ฆฌ๋ฅผ ํ•ด์ค˜์„œ ์•ž์œผ๋กœ๋„ ๋งŽ์ด ์จ์•ผ๊ฒ ๋”๋ผ๊ตฌ์š”.

์œ„์™€ ๊ฐ™์€ ๋ฐฉ๋ฒ•์œผ๋กœ ์„ธํŒ…์„ ํ•ด์ฃผ๊ณ  ์ƒˆ๋กœ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•  ๋•Œ์—๋Š”... ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐฉ๋ฒ•์„ ๋ฐ˜๋ณตํ•˜์—ฌ ์„ธํŒ…ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • go mod init: module ํŒŒ์ผ ์ดˆ๊ธฐ์ƒ์„ฑ
  • go get -u "": import์—์„œ ์‚ฌ์šฉํ•˜๋Š” module ์ •์˜
  • *.go: go lang์„ ์ด์šฉํ•œ ํŒŒ์ผ ์ž‘์„ฑ

+ VSCode Extension

2. Golang ๊ฐœ๋ฐœํ™˜๊ฒฝ ํ…Œ์ŠคํŠธ

go ์–ธ์–ด๊ฐ€ ์„œ๋ฒ„ ๊ฐœ๋ฐœ์— ์ฃผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ์–ธ์–ด๋‹ค๋ณด๋‹ˆ๊นŒ ์ตœ๊ทผ์— ๊ณต๋ถ€ํ•œ HTTP/2 client server ์ฝ”๋“œ๋ฅผ ๋ฌผ์–ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.

2.1 HTTP/2 Server Code

package main

import (
    "fmt"
    "log"
    "net/http"
    "golang.org/x/net/http2"
)

func main() {
    // Create a handler to handle requests
    handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "Hello, HTTP/2!")
    })

    // Create an http2 server
    server := &http.Server{
        Addr:    ":8080",
        Handler: handler,
    }
    http2.ConfigureServer(server, &http2.Server{})

    // Listen and serve requests
    err := server.ListenAndServeTLS("server.crt", "server.key")
    if err != nil {
        log.Fatal("ListenAndServeTLS: ", err)
    }
}โ€‹

2.2 HTTP/2 Client Code

package main

import (
    "crypto/tls"
    "net/http"
    "golang.org/x/net/http2"
    "fmt"
    "io/ioutil"
    "log"
)

func main() {
    // Create a new HTTP/2 client
    tr := &http2.Transport{
        TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
    }
    client := &http.Client{Transport: tr}

    // Make a request to localhost:8080
    req, err := http.NewRequest("GET", "https://localhost:8080", nil)
    if err != nil {
        panic(err)
    }

    // Set any additional headers or parameters here
    // ...

    // Send the request and get the response
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatalf("Failed reading response body: %s", err)
	}

    // Do something with the response here
    // ...
	fmt.Printf("Got response %d: %s %s\n", resp.StatusCode, resp.Proto, string(body))
}

 

2.3 HTTP/2 Server Client Code ์‹คํ–‰

HTTP/2 client Server๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” prerequest๊ฐ€ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ์˜ ๊ณผ์ •์„ ํ†ตํ•ด ์‹คํ–‰ํ•˜์—ฌ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

2.3.1 import ๋ชจ๋“ˆ ์ถ”๊ฐ€

go get -u crypto/tls net/http golang.org/x/net/http2 fmt io/ioutil log

2.3.2 cert, key ์ถ”๊ฐ€

HTTP/2 ํŠน์„ฑ์ƒ TLS ์ธ์ฆ์„ ๊ฑฐ์ณ์•ผ ํ•˜๊ธฐ์— cert, key๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.์—ฌ๊ธฐ์„œ ๋กœ์ปฌ ๊ฐœ๋ฐœ์šฉ์œผ๋กœ๋Š” CA์˜ ๋„์›€์—†์ด ๋ˆ„๊ตฌ๋‚˜ ๊ณ ์œ  ์ธ์ฆ์„œ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์œผ๋ฉฐ, localhost์— ๋Œ€ํ•œ ๊ฐœ์ธ ํ‚ค์™€ ์ž์ฒด ์„œ๋ช…๋œ ์ธ์ฆ์„œ๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ openssl ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

openssl req -x509 -out server.crt -keyout server.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=localhost' -extensions EXT -config <( \
   printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
  • [Blog] Certificates for localhost: https://letsencrypt.org/ko/docs/certificates-for-localhost/

2.3.3 Server, Client ์‹คํ–‰

$ go run server.go

$ go run client.go
Got response 200: HTTP/2.0 Hello, HTTP/2!โ€‹

์ฐธ๊ณ 

  • [OpenAI] ChatGPT: https://chat.openai.com/chat/
  • [Blog] Certificates for localhost: https://letsencrypt.org/ko/docs/certificates-for-localhost/
๋ฐ˜์‘ํ˜•
์ €์ž‘์žํ‘œ์‹œ ๋น„์˜๋ฆฌ ๋ณ€๊ฒฝ๊ธˆ์ง€ (์ƒˆ์ฐฝ์—ด๋ฆผ)

'Study: DeveloperTools(DevTool) > DevTool: IDE' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[IDE] Google Colab์„ ์œ„ํ•œ ํŒ: ์„ธ์…˜ ์œ ์ง€, GPU/TPU ํ• ๋‹น, Google Drive ์—ฐ๋™, Package Updata ๋ฐ˜์˜  (0) 2023.07.27
[IDE] ๋น„๋ฐ€๋ฒˆํ˜ธ ์—†์ด VSCode๋กœ ์›๊ฒฉ ์„œ๋ฒ„ ์ ‘์†ํ•˜๊ธฐ(feat. VSCode Remote Development)  (0) 2023.05.17
[IDE] Intellij Springboot ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •(feat. spring initializr)  (0) 2023.02.14
[IDE] VSCode Springboot ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ • (MacOS M1)  (0) 2023.01.21
[IDE] VSCode React + .Net ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ • (MacOS M1)  (0) 2023.01.16
    'Study: DeveloperTools(DevTool)/DevTool: IDE' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€
    • [IDE] Google Colab์„ ์œ„ํ•œ ํŒ: ์„ธ์…˜ ์œ ์ง€, GPU/TPU ํ• ๋‹น, Google Drive ์—ฐ๋™, Package Updata ๋ฐ˜์˜
    • [IDE] ๋น„๋ฐ€๋ฒˆํ˜ธ ์—†์ด VSCode๋กœ ์›๊ฒฉ ์„œ๋ฒ„ ์ ‘์†ํ•˜๊ธฐ(feat. VSCode Remote Development)
    • [IDE] Intellij Springboot ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •(feat. spring initializr)
    • [IDE] VSCode Springboot ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ • (MacOS M1)
    DrawingProcess
    DrawingProcess
    ๊ณผ์ •์„ ๊ทธ๋ฆฌ์ž!

    ํ‹ฐ์Šคํ† ๋ฆฌํˆด๋ฐ”