{"id":15319043,"url":"https://github.com/appleboy/go-hello","last_synced_at":"2025-04-14T00:34:57.010Z","repository":{"id":57578937,"uuid":"49146370","full_name":"appleboy/go-hello","owner":"appleboy","description":"hello world for go lang","archived":false,"fork":false,"pushed_at":"2019-10-19T15:51:51.000Z","size":382,"stargazers_count":8,"open_issues_count":0,"forks_count":18,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T10:08:02.646Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appleboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-06T16:16:30.000Z","updated_at":"2023-08-16T15:58:12.000Z","dependencies_parsed_at":"2022-09-26T19:11:45.001Z","dependency_job_id":null,"html_url":"https://github.com/appleboy/go-hello","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fgo-hello","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fgo-hello/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fgo-hello/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fgo-hello/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appleboy","download_url":"https://codeload.github.com/appleboy/go-hello/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245863278,"owners_count":20684822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T09:03:10.518Z","updated_at":"2025-03-27T14:32:57.934Z","avatar_url":"https://github.com/appleboy.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-hello\n\nhello world for go lang example.\n\n[![Build Status](https://travis-ci.org/appleboy/go-hello.svg?branch=master)](https://travis-ci.org/appleboy/go-hello) [![Go Report Card](https://goreportcard.com/badge/github.com/appleboy/go-hello)](https://goreportcard.com/report/github.com/appleboy/go-hello) [![codecov](https://codecov.io/gh/appleboy/go-hello/branch/master/graph/badge.svg)](https://codecov.io/gh/appleboy/go-hello) [![Coverage Status](https://coveralls.io/repos/github/appleboy/go-hello/badge.svg?branch=master)](https://coveralls.io/github/appleboy/go-hello?branch=master) [![Build Status](http://drone.wu-boy.com/api/badges/appleboy/go-hello/status.svg)](http://drone.wu-boy.com/appleboy/go-hello)\n\n## Getting Started\n\nInstall dependencies package.\n\n```bash\n$ go get -d\n```\n\nStart web server and default port is `8000`\n\n```bash\n$ go run hello-world.go\n```\n\nYou can change default port via add `port` flag.\n\n```bash\n$ go run hello-world.go -port=8009\n```\n\n## Using Docker\n\nPlease install [Docker](https://docs.docker.com/machine/get-started/) first and run the following command to start server.\n\n```bash\n$ make all\n```\n\nOpen your browser with `http://your_docker_ip:8000` and get the follwoing message.\n\n```javascript\n{\n  \"current_time\":\"2016-02-14T07:50:27.536032273Z\",\n  \"text\":\"hello world\"\n}\n```\n\nCheck docker process:\n\n```bash\n$ docker ps\nCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES\nd044b5041e8e        hello-world         \"/bin/sh -c /app/hell\"   About an hour ago   Up About an hour    0.0.0.0:8000-\u003e8000/tcp   hello-production\n```\n\nCheck docker images:\n\n```bash\n$ docker images\nREPOSITORY                  TAG                 IMAGE ID            CREATED             VIRTUAL SIZE\nhello-world                 latest              5cca15b3231f        43 seconds ago      15.98 MB\nhello-world-build           latest              472296ce571d        47 seconds ago      282.5 MB\n```\n\nRebuild your image.\n\n```bash\n$ make build\ndocker build -t \"hello-world-build\" -f Dockerfile.build .\nSending build context to Docker daemon 789.5 kB\nStep 1 : FROM golang:1.6-alpine\n ---\u003e 7ae766a8518d\nStep 2 : MAINTAINER Bo-Yi Wu \u003cappleboy.tw@gmail.com\u003e\n ---\u003e Using cache\n ---\u003e 9cee8a14fec4\nStep 3 : RUN apk --update add git\n ---\u003e Using cache\n ---\u003e d17daae20ba7\nStep 4 : RUN mkdir -p /tmp/build\n ---\u003e Using cache\n ---\u003e cf511150ec0e\nStep 5 : ADD hello-world.go /tmp/build/\n ---\u003e Using cache\n ---\u003e 02e933c9c453\nStep 6 : WORKDIR /tmp/build\n ---\u003e Using cache\n ---\u003e a0d43ae462b5\nStep 7 : RUN go get -d\n ---\u003e Running in b02a8bd86c4f\n ---\u003e 4946d82c8d0f\nRemoving intermediate container b02a8bd86c4f\nStep 8 : RUN go build hello-world.go\n ---\u003e Running in b88fcda825f1\n ---\u003e 8e25074145ff\nRemoving intermediate container b88fcda825f1\nStep 9 : CMD tar -czf - hello-world\n ---\u003e Running in 2c6e38a708c7\n ---\u003e 472296ce571d\nRemoving intermediate container 2c6e38a708c7\nSuccessfully built 472296ce571d\ndocker run \"hello-world-build\" \u003e build.tar.gz\ndocker build -t \"hello-world\" -f Dockerfile.dist .\nSending build context to Docker daemon 4.007 MB\nStep 1 : FROM gliderlabs/alpine:3.3\n ---\u003e 24e7cde1dbe9\nStep 2 : MAINTAINER Bo-Yi Wu \u003cappleboy.tw@gmail.com\u003e\n ---\u003e Using cache\n ---\u003e 73e6d76da566\nStep 3 : RUN mkdir /app\n ---\u003e Using cache\n ---\u003e c8c863a62423\nStep 4 : ADD build.tar.gz /app/\n ---\u003e 12ef80e2e0c6\nRemoving intermediate container 38ef062dc3bd\nStep 5 : ENTRYPOINT /app/hello-world\n ---\u003e Running in a4781a03cfd4\n ---\u003e 07f53380e131\nRemoving intermediate container a4781a03cfd4\nStep 6 : EXPOSE 8000\n ---\u003e Running in 967f83e5c5f6\n ---\u003e 5cca15b3231f\nRemoving intermediate container 967f83e5c5f6\nSuccessfully built 5cca15b3231f\n```\n\nRestart your app server.\n\n```bash\n$ make server\ndocker rm -f hello-production\nhello-production\ndocker run -d -p 8000:8000 --name \"hello-production\" \"hello-world\"\n52723b9e29c2a422451e7a5e73fbd44be83c730006c02667140b43cf7f73c146\n```\n\nDeploy your image to [docker hub](https://hub.docker.com)\n\n```bash\n$ make deploy tag=4.0\ndocker tag \"hello-world\":latest \"appleboy\"/\"hello-world\":4.0\ndocker push \"appleboy\"/\"hello-world\":4.0\nThe push refers to a repository [docker.io/appleboy/hello-world] (len: 1)\n80d1436c2e8f: Image already exists\nc4bc05068eb6: Image already exists\nc8c863a62423: Image already exists\n24e7cde1dbe9: Image already exists\n4.0: digest: sha256:b5b6bd28e8a4ced89d4e38fe05b9fa4d8f3483f23f23ef1ab0f66b23ffdbcf0e size: 9507\n```\n\n## Testing\n\n```bash\n$ make test\ngo test -v -cover\n=== RUN   TestGinHelloWorld\n--- PASS: TestGinHelloWorld (0.00s)\n=== RUN   TestRunNormalServer\n--- PASS: TestRunNormalServer (0.03s)\nPASS\ncoverage: 100.0% of statements\nok      github.com/appleboy/go-hello    0.038s \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleboy%2Fgo-hello","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappleboy%2Fgo-hello","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleboy%2Fgo-hello/lists"}