Giter Site home page Giter Site logo

xaionaro-go / tinyhelloworld Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 0.0 13 KB

A very synthetic, but very small hello world in Go. **It takes 91 bytes when compiled (as a static binary).**

License: Creative Commons Zero v1.0 Universal

Makefile 27.69% Assembly 30.96% Go 11.83% Dockerfile 25.30% Shell 4.22%
golang tiny tinygo hello-world go example size small static hello

tinyhelloworld's Introduction

CC0
To the extent possible under law, Dmitrii Okunev has waived all copyright and related or neighboring rights to "A very synthetic, but very small hello world on Go. This work is published from: Ireland".

Quick start

$ rm -f tinyhelloworld
$ docker build -t build-go-tinyhelloworld . && docker run -v "$(pwd):/project" build-go-tinyhelloworld
$ stat -c %s ./tinyhelloworld
91
$ ./tinyhelloworld
Hello, world!

OR

$ rm -f tinyhelloworld
$ make all
$ stat -c %s ./tinyhelloworld
91
$ ./tinyhelloworld
Hello, world!

Hexdump

$ hexdump -C tinyhelloworld 
00000000  7f 45 4c 46 01 00 00 00  00 00 00 00 00 00 00 01  |.ELF............|
00000010  02 00 03 00 00 00 00 01  2e 00 00 01 04 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 20 00 01 00 e8 07  |.......... .....|
00000030  00 00 00 31 c0 31 db 40  cd 80 53 6a 04 58 31 db  |[email protected].|
00000040  43 6a 0e 5a b9 4d 00 00  01 cd 80 5b c3 48 65 6c  |Cj.Z.M.....[.Hel|
00000050  6c 6f 2c 20 77 6f 72 6c  64 21 0a                 |lo, world!.|
0000005b

Comments

elf.asm is just ELF-headers and a wrapper to call the main().

The binary could be even less if we place our useful data right into the ELF headers (see an example).

See also

Why is Go binary so big

A collection of articles explains some details about Go:

tinyhelloworld's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.