15minblog

Next.jsのpre-renderingメモ

Pre-rendering By default, Next.js pre-renders every page. This means that Next.js generates HTML for each page in advance, instead of having it all done by client-side JavaScript. Pre-rendering can result in better performance and SEO. Jav…

Types assertions

Types assertions interface typeの変数が実際に持っているtypeをチェックする 記法 // 戻り値2個パターン t, ok := i.(T) // 戻り値1個パターン t := i.(T) 戻り値(2個返す場合) t, ok := i.(T) 1個目: 成功:interface型の変数が実際にチェックした型を…

raw string literals and interpreted string literals.

Topic string literalには raw string literal と interpreted string literal の二種類がある The Go Programming Language Specification Summary raw string litreral バッククォートで囲む 名前の通り、改行などがそのまま使える \ が特別な意味を持たな…

typed/untyped constant

Topic golangのconstantについて The Go Blog Summary constantにはtypedとuntypedの二種類がある Default type typed const typedHello string = "Hello, world" untyped "Hello, world" const hello = "Hello, world" この場合、 str のtypeは? //右オペ…

CLI作成で使うパッケージ① spf13/cobra

Topic 今回、CLI作成で使うパッケージ① → cobra spf13/cobra cobraが使われているプロジェクト spf13/cobra Summary 以下、cobraに依存する機能 CLI Framework / Main Entry point Command Routing Error Handling Help Text (Don't forget to customize!) F…

Package level scope

Topic Package level scopeの変数 Summary 変数を定義する時に var キーワードを使うが、定義する場所でスコープが変わる。(package levelとfunction level) package main import "fmt" var c, python, java bool ← at Package level func main() { var i …

CLIの設計

Topic golangでCLIを(しっかり設計して)作ってみる。設計で意識するところ Summary Sentence Readability Antipattern Avoid positional arguments where the order matters emote add repo funk https://x.com/funk.json emote add repo https://x.com/f…

golangでCLIをしっかり作ろう

Topic CLIを設計できるようになろうの一回目 Summary 以下のレポート記事を読んで、実際に同じものを作ってみる。 GopherCon 2019 - Design Command-Line Tools People Love YouTube Designing Command-Lile Tool People Love GopherCon 2019: Carolyn Van S…