Giter VIP home page Giter VIP logo

go-study's Introduction

メモ

  • モジュール https://pkg.go.dev/std

  • intは基本的にint64を使う

  • メモリを気にする場合は、キャパシティを使う

  • try~catch~finallyの例外処理はない

  • ポインタを使う場合は、newを使う、使わない場合は、makeを使う

  • コンポジ型とは、構造体の中に構造体を入れること

  • 小文字の場合は、パケージ内でしか参照できない

  • interfaceは、メソッドの集まりで、必ず実装する必要があるメソッドがある場合に使う

  • tyeps https://go.dev/ref/spec

goroutine

  • fan-out fan-in
    • fan-out: 複数のgoroutineを起動すること
    • fan-in: 複数のgoroutineからの結果を受け取ること
    • channelでパイプラインを持たせたいときに使う

コマンド

  • go run [fileName] ファイルを実行
  • gofmt -w [fileName] フォーマットを整える
  • go doc [packageName] ドキュメントを見る

batchリポジトリの構成

.
├── app                    # アプリケーションのコアロジックを含むディレクトリ
│   └── mail               # メール処理タスク専用のディレクトリ
│       ├── logic          # メール処理のビジネスロジックを格納
│       └── executor.go    # メール処理ロジックの実行を担当するファイル
├── config                 # アプリケーション設定ファイルを保存するディレクトリ。データベース接続やAPIキーなどを含む
│   └── XXXX_config.go
├── library                # 共通のコード、ライブラリ、ユーティリティを含むディレクトリ。ヘルパー関数やミドルウェアなどを含む
├── go.mod                 # プロジェクトの依存関係を定義するGoモジュールファイル
└── go.sum                 # 依存関係の整合性を保証するためのチェックサムを提供するファイル

参考になりそうなディレクトリ構成

go-study's People

Contributors

yoppydev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.