컴퓨터/Go language
-
Wails: Go언어를 이용해 크로스 플랫폼 앱 만들기컴퓨터/Go language 2022. 6. 26. 12:38
Wails The Wails Project | Wails Build beautiful cross-platform applications using Go wails.io 소개 Wails는 Go언어를 이용하여 크로스 플랫폼 앱을 만들게 도와준다. (MacOS/Windows/Linux) 프런트엔드는 Svelete, React 등을 사용해서 할 수 있고, wails는 Go언어로 빌드나 함수 -> JS를 도와준다. 설치는 쉬우니 공식 사이트를 확인하면 된다. @공식 문서 만들면서 배운 것 Svelte랑 프런트엔드 쪽은 많이 안 해봐서 쉬운 것부터 시작했다. 대학교 공지 홈페이지에서 각 카테고리별로 Go언어로 파싱하고 앱에 뿌리는 것이다. Go언어 Struct -> TypeScript 우선 Go언어로 짠 struc..
-
Golang: Struct memory 최적화 (구조체 크기)컴퓨터/Go language 2022. 1. 29. 00:27
The Go Programming Language Download Go Binary distributions available for Linux, macOS, Windows, and more. // You can edit this code! // Click here and start typing. package main import "fmt" func main() { fmt.Println("Hello, 世界") } Hello, World! Conway's Game of Life Fibonacci golang.org Struct 같은 primitive 타입 attributes 같지만 크기는 다른 두 구조체 type ComputerBig struct { // 48 bytes IsPowerOn bool Nam..
-
Go언어: Generics 이용하기 (v1.17+)컴퓨터/Go language 2021. 3. 24. 22:22
The Go Programming Language Download Go Binary distributions available for Linux, macOS, Windows, and more. // You can edit this code! // Click here and start typing. package main import "fmt" func main() { fmt.Println("Hello, 世界") } Hello, World! Conway's Game of Life Fibonacci golang.org Go 1.17 버전 이상 Generic이 드디어 생겼다. (욕먹던 부분) type X interface로 지정 후 또는 (any로 모든 타입 받을 수 있음) 자바처럼 T로 사용하면 된다. 1...
-
Golang: 카카오 챗봇 API 응답 JSON 빌더 헬퍼 모듈컴퓨터/Go language 2021. 2. 21. 13:44
The Go Programming Language Download Go Binary distributions available for Linux, macOS, Windows, and more. // You can edit this code! // Click here and start typing. package main import "fmt" func main() { fmt.Println("Hello, 世界") } Hello, World! Conway's Game of Life Fibonacci golang.org 소개 아래 글을 참고해보면, Golang으로 챗봇 서버를 만들면 빠르지만 파이썬처럼 dictionary를 쉽게 사용할 수 없기 때문에 Golang: gin으로 카카오 챗봇 서버 만들기 gin ..
-
Golang: soup를 이용한 네이버 날씨 정보 가져오기컴퓨터/Go language 2021. 2. 14. 17:49
Go The Go Programming Language Download Go Binary distributions available for Linux, macOS, Windows, and more. // You can edit this code! // Click here and start typing. package main import "fmt" func main() { fmt.Println("Hello, 世界") } Hello, World! Conway's Game of Life Fibonacci golang.org 1. 크롤링 우선 데이터를 가져올 사이트는 다음과 같다. ?cpName=ACCUWEATHER을 넘겨서 아큐웨더 제공자 사용함 (아주대 지역 날씨) 네이버 날씨 국내외 날씨와 미세먼지에 대..
-
Golang: JSON <, >, & HTML 기호 escape 하기컴퓨터/Go language 2021. 2. 9. 15:42
Go The Go Programming Language Download Go Binary distributions available for Linux, macOS, Windows, and more. // You can edit this code! // Click here and start typing. package main import "fmt" func main() { fmt.Println("Hello, 世界") } Hello, World! Conway's Game of Life Fibonacci golang.org 기본적으로 Marshal은 HTML 기호들을 escape를 안 한다. (&, >,
-
Golang: Nested structs to JSON (중첩 struct Json만들기)컴퓨터/Go language 2021. 1. 3. 18:45
Struct안에 anonymous 구조체나 구조체를 계속 중첩해서 만들 수 있다. 하지만 이 방식은 점점 익명 구조체가 많아질수록 코딩이 길어지고 힘들다. 그래서 익명 구조체를 쓰지 않고 하나하나 모델을 다 만들어서 사용하는 게 일반적이다. 1. 중첩 익명 구조체 type Nested struct { Hello struct { Inside string `json:"inside"` } `json:"hello"` Bye string `json:"bye"` } // 메인 함수 func main() { var data Nested data = Nested{ Hello: struct { Inside string `json:"inside"` }{Inside: "hello"}, Bye: "world", } b, _ ..
-
Golang: gin으로 카카오 챗봇 서버 만들기컴퓨터/Go language 2021. 1. 1. 22:57
gin gin-gonic/gin Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin. - ... github.com 카카오 챗봇 Python으로 만들기 링크 카카오 챗봇 Rust언어로 만들기 링크 카카오 챗봇 예제 서버 Python FastAPI 소스 링크 카카오 챗봇 풀 예제 Github 링크 1. gin gin은 Python의 Flask, FastAPI처럼 웹 서버를 만들 수 있는 웹 프레임워크이다. 웹 프레임..