Giter VIP home page Giter VIP logo

devcontainer-atgo-go's Introduction

devcontainer-atgo-go

This is the devcontainer environment for using atgo.
atgo is a tool for playing AtCoder by Go language.

Advantages of Using a Container Environment

AtCoder provides the Go language environment in version 1.20.6, but the latest version of Go language is 1.22 or later.
Since the Go language is backward compatible, code written in 1.20 will in principle work in 1.22 or later as long as the version is specified in go.mod.
However, it is not guaranteed that the behavior will be the same, so even if the code is executed correctly in a local test, it may cause a WA on AtCoder due to a different behavior.
To solve this problem, it is necessary to prepare 1.20.6 go in the local environment, but the container environment can easily supply it.

Pre-requisite environment

Installation

Run the following command on the root directory of the workspace where you will be working with AtCoder using atgo.

$ git clone https://github.com/meian/devcontainer-atgo-go .devcontainer

Then open it on vscode as devcontainer on vscode using the Dev Containers.

Usage

Running atgo

atgo is installed when the container is started, so you can use it with vscode in devcontainer.

# Authenticate
$ atgo auth

# Display contest info.
$ atgo contest abc123

# Create task implements files in your workspace
$ atgo task local-init abc123_a

Subcommand completion with bash-completion is also available.
(Only standard provided by cobra)

Updating atgo

When the latest version of atgo is released, you can update it with the following command.

# update script
# If the latest version is released locally, nothing will be processed
$ update-atgo

# Force re-installation of the latest version locally
# (not sure if there is a needs or not)
$ update-atgo -f

vscode extensions

Default installed extensions

The following extensions are automatically installed when devcontainer is started.

Additional extensions

Basically, any extensions can be installed, but the following extensions can be installed using the provided script.

# List supported extensions
$ add-vsc-extension 
all extensions list:
(installed) github.copilot
            windmilleng.vscode-go-autotest

# Install extension (IDs can be TAB-completed)
$ add-vsc-extension windmilleng.vscode-go-autotest
Extension 'windmilleng.vscode-go-autotest' is installed...
The extension 'windmilleng.vscode-go-autotest' v1.6.0 has been successfully installed.

License

This tool is licensed under the MIT License.

devcontainer-atgo-go's People

Contributors

meian avatar

Watchers

 avatar

devcontainer-atgo-go's Issues

GoのバージョンをAtCoderで提供される1.20.6に厳密に合わせる

現行のDockerfileはマイナーバージョンまでしか指定していないため、AtCoderが提供するgo 1.20.6と確実に一致する保証がない。

FROM mcr.microsoft.com/devcontainers/go:1.20-bookworm as atcoder

そのためコンテナが動作する環境として、go 1.20.6ベースで構築されるように変更する。

  • 可能であれば DockerHub のイメージからdevcontainer環境を再構築する
  • ↑が難しければmcrの1.20系のイメージを利用して、goのバイナリを1.20.6に置き換える

chownの調整

sudo mkdir -p /go/pkg
sudo chown vscode:golang /go/pkg
sudo mkdir -p "/home/$u/.cache/go-build"
sudo chown vscode:vscode "/home/$u/.cache/go-build"

  • 外部からユーザー名を渡しているがchownは固定のユーザー・グループで処理されているので直した方が良さそう
    • golangグループはそのままで良さそう?

README

README.md を英語で、 README-ja.md を日本語で作成して相互リンクする

  • ツールの説明
  • インストール方法
  • コンテナ内のワークスペースとホストディレクトリのマウント位置の関係
  • atgoのアップデート方法
  • 拡張機能のインストール方法

vscodeの拡張機能

コンテナ内で利用できる拡張機能を実行時インストールまたは任意のタイミングでインストールできるようにする

必ずインストールして良さそうなものはdevcontainer.json、それ以外はインストールスクリプトを用意する

  • devcontainer.jsonに記述
    • golang
      • goplsなど対応する拡張機能のビルドも追加する
    • 日本語拡張
  • インストールスクリプト
    • Copilot Chat
    • Go Autotest

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.