Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Goではじめるバックエンド開発
Search
ak2ie
June 17, 2023
Technology
90
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Goではじめるバックエンド開発
2023/06/17「【Developers Guild】バックエンドエンジニア交流会」での発表資料です
ak2ie
June 17, 2023
More Decks by ak2ie
See All by ak2ie
DDDのエッセンスを取り入れたAIでの開発
ak2ie
1
280
Claude Codeはレガシー移行でどこまで使えるのか?
ak2ie
1
1.7k
SVG完全に理解してグラフ書いてみた
ak2ie
0
70
Go言語CLIツールで生産効率UPした話
ak2ie
0
130
Notion APIと学ぶNext.js
ak2ie
0
600
NestJSのはじめ方
ak2ie
0
170
フロントエンドでDDDやってみた
ak2ie
0
90
初心者がシビックテックに参加してみた
ak2ie
0
140
Firebase についてとことん語りたい
ak2ie
0
130
Other Decks in Technology
See All in Technology
DEFCON34-Write-up_HYCu-MYCu
daikiokazaki
0
160
30座EKS, 180次升級淬煉的EKS Upgrade Skill 的歷程
eric8230
0
170
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
20260912_スクラムにジェネラリストは必要か
ryugen04
0
420
10分で知る最近のOmarchy
komagata
0
340
AIによるクリエイティブ生成を行う上での試行錯誤
plaidtech
PRO
0
150
山手線を徒歩で一周してわかった、 位置情報アプリは「足」が最強のデバッガー
hinakko
0
160
【技術的負債conf】事業成長に伴う技術的負債の説明責任とAIによるモニタリング、認知的負債について
i35_267
2
1.6k
アプリをもっと"iOSアプリっぽく"する小さな工夫 / Small Touches That Make Your App Feel More Like an iOS App
matsuji
1
900
Issue 駆動でスペシャリストの意図を届ける、AI 実装のアクセシビリティ向上
thkt
0
110
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
490
Minecraft JavaのMODをSwiftで作る
1mash0
0
160
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Paper Plane
katiecoart
PRO
4
53k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
A better future with KSS
kneath
240
18k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
660
Side Projects
sachag
456
43k
Transcript
Goではじめる バックエンド開発 2023/06/17
自己紹介 • 名前:ak2ie • 職業:Webエンジニア • 好きなもの:コーヒー、YouTube
バックエンド どんな言語で開発してますか?
Ruby on Rails?
PHP?
TypeScript?
Go!
目次 • Goとは • Goを使っている企業 • Goの特徴 • HTTPサーバー •
テスト • DB操作
Goとは • Googleが2012年にリリースしたプログラミング言語 • マスコットキャラクターはGopher(ゴーファー) • 半年に1度バージョンアップし、最新バージョンは1.20 • ver.1系は後方互換性があるので、仕事でも安心して使える by
Renée French
Goを使っている企業 • メルカリ ◦ メルカリUSのバックエンドで採用 • ヤフー ◦ 分散オブジェクトストレージをGoで実装 https://findy-code.io/engineer-lab/go-findy-event-1
https://www.slideshare.net/techblogyahoo/go-go-conference-2017-spring
Goの特徴 • 静的型付き言語 • シンプルな構文(ループはfor文のみ) • 標準ライブラリが充実 ◦ HTTPリクエスト処理 ◦
DB操作 ◦ テスト • Goを初めて学ぶ方は「プログラミング言語 Go完全入門」がおすすめ http://tenn.in/go
HTTPサーバー • 標準ライブラリでHTTPリクエスト を処理できる • http://localhost:8080/hello で”hello world!”を返す package main
import ( "net/http" ) type Handler struct{} func Hello(w http.ResponseWriter, r *http.Request) { w.Write([]byte("hello world!")) } func main() { http.HandleFunc("/hello", Hello) http.ListenAndServe(":8080", nil) } 処理 ルーター
テスト • 標準ライブラリでテストを実 行できる • テスト関数 ◦ _test.goで終わる ◦ Testから始まる
◦ *testing.Tが引数 // main_test.go package main import ( "net/http" "net/http/httptest" "testing" ) func TestHello(t *testing.T) { r := httptest.NewRequest(http.MethodGet, "/hello", nil) w := httptest.NewRecorder() Hello(w, r) if w.Body.String() != "hello world!" { t.Errorf("result should be \"hello world!\", but %s", w.Body.String()) } } 検証 処理
DB操作 • 基本的操作は標準ライブラリで実装可能 • エンジンに応じてドライバーを使い分ける ◦ PostgreSQLなら”jackc/pgx”など • DB接続 ◦
db, err := sql.Open(“pgx”, “【接続情報】”) • クエリ実行 ◦ db.Query(“【クエリ】”)
まとめ • GoはGoogleがリリースしたプログラミング言語 • 現在ver.1.20が最新。ver.1系は後方互換性があるので仕事でも使える • 有名企業でも採用事例あり • 構文がシンプル •
標準ライブラリが充実 ◦ HTTPサーバー ◦ DB ◦ テスト