Giter Club home page Giter Club logo

golang-playground's Introduction

Golang 游乐场 (Go Playground)

基于 Golang 官方项目调整而来,让你可以在本地快速启动一套 Golang Web Playground,来快速验证各种 Golang 代码片段。

项目特点

  • 支持完全离线运行,无需“联网”,不需担心有任何信息泄漏的风险(比如包含密钥的程序)。
  • 支持使用容器进行快速启动,不锁定任何公有云或者复杂的运行环境。
  • 和官方程序一样,使用沙盒方式运行 Golang 程序,确保运行程序安全,无副作用。
  • 和官方程序一样,使用 faketime “模块”,让程序能够提供确定性的输出,让程序复现和结果缓存变的更加容易。
  • 合并了来自 go.dev 的默认示例,并进行了适当的界面“汉化”。
  • 大幅精简程序模块和依赖,减少不必要的资源消耗。

快速开始

想要运行程序,首先需要先安装 Docker,桌面操作系统可以访问官网下载安装文件,服务器版本的 Docker 安装,可以参考这里

然后,执行下面的命令或者项目中的程序(bash pull-images.sh),获取必要的镜像文件:

docker pull soulteary/golang-playground:web-1.19.0
docker pull soulteary/golang-playground:sandbox-1.19.0
docker pull soulteary/golang-playground:actuator-1.19.0
docker pull memcached:1.6.15-alpine

接着,在镜像获取完毕之后,使用 docker-compose up -ddocker compose up -d,启动程序。

最后,打开浏览器,访问 http://localhost:8080,就可以开始 Golang 之旅啦。

构建镜像

如果你希望进行二次开发,或者“自己动手”从零构建这套程序,可以执行项目目录中的程序(bash make-images.sh),程序会自动构建运行所需要的各种镜像。

# bash make-images.sh
Sending build context to Docker daemon  1.349MB
Step 1/30 : ARG GO_VERSION=1.19.0
Step 2/30 : FROM golang:${GO_VERSION}-alpine3.16 AS build-playground
 ---> 5e999c13ceac
Step 3/30 : LABEL maintainer="[email protected]"
 ---> Using cache
 ---> a253b22ef53a
...
Successfully built 37e124ce9e7f
Successfully tagged soulteary/golang-playground:web-1.19.0
...
Successfully built 6017738b85ce
Successfully tagged soulteary/golang-playground:sandbox-1.19.0
Step 1/24 : ARG GO_VERSION=1.19.0
Step 2/24 : FROM golang:${GO_VERSION}-alpine3.16 AS build-sandbox
...
Successfully built c51b8a6647fb
Successfully tagged soulteary/golang-playground:actuator-1.19.0

golang-playground's People

Contributors

soulteary avatar toothrot avatar andybons avatar adg avatar bradfitz avatar broady avatar ysmolski avatar findleyr avatar dmitshur avatar proppy avatar rsc avatar smasher164 avatar katiehockman avatar ucirello avatar filosottile avatar campoy avatar heschi avatar jamalc avatar johnmccabe avatar josharian avatar julieqiu avatar stapelberg avatar leitzler avatar shawnps avatar minux avatar cuishuang avatar mo4islona 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.