{"id":16105866,"url":"https://github.com/devlights/go-crosscompile-example","last_synced_at":"2025-04-06T03:13:41.085Z","repository":{"id":149716564,"uuid":"311580030","full_name":"devlights/go-crosscompile-example","owner":"devlights","description":"This is example that makes cross-compile using golang.","archived":false,"fork":false,"pushed_at":"2020-11-10T08:18:44.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-12T08:58:43.593Z","etag":null,"topics":["cross-platform","golang"],"latest_commit_sha":null,"homepage":"","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/devlights.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-10T07:32:55.000Z","updated_at":"2024-11-04T17:29:33.000Z","dependencies_parsed_at":"2023-04-14T07:32:09.342Z","dependency_job_id":null,"html_url":"https://github.com/devlights/go-crosscompile-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-crosscompile-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-crosscompile-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-crosscompile-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-crosscompile-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlights","download_url":"https://codeload.github.com/devlights/go-crosscompile-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427012,"owners_count":20937214,"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":["cross-platform","golang"],"created_at":"2024-10-09T19:10:57.513Z","updated_at":"2025-04-06T03:13:41.069Z","avatar_url":"https://github.com/devlights.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-crosscompile-example\nThis is example that makes cross-compile using golang.\n\n[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/devlights/go-crosscompile-example)\n\n## Go のクロスコンパイルについて\n\nGoでは簡単にクロスコンパイルが行えます。\n\nやり方は ビルド時に以下の2つの環境変数を設定しておくことです。\n\n- GOOS\n- GOARCH\n\nGOOSとGOARCHの組み合わせを指定することで各環境向けのビルドモジュールを作ることが出来ます。\n\n組み合わせは以下に記載されています。\n\n[Optional environment variables](https://golang.org/doc/install/source#environment)\n\n2020-11-10 時点だと以下が有効な組み合わせとのこと。\n\n|$GOOS|$GOARCH|\n| ---- | ---- |\n|aix|ppc64|\n|android|386|\n|android|amd64|\n|android|arm|\n|android|arm64|\n|darwin|amd64|\n|darwin|arm64|\n|dragonfly|amd64|\n|freebsd|386|\n|freebsd|amd64|\n|freebsd|arm|\n|illumos|amd64|\n|js|wasm|\n|linux|386|\n|linux|amd64|\n|linux|arm|\n|linux|arm64|\n|linux|ppc64|\n|linux|ppc64le|\n|linux|mips|\n|linux|mipsle|\n|linux|mips64|\n|linux|mips64le|\n|linux|s390x|\n|netbsd|386|\n|netbsd|amd64|\n|netbsd|arm|\n|openbsd|386|\n|openbsd|amd64|\n|openbsd|arm|\n|openbsd|arm64|\n|plan9|386|\n|plan9|amd64|\n|plan9|arm|\n|solaris|amd64|\n|windows|386|\n|windows|amd64|\n\n## 実行サンプル\n\n```sh\n$ cat /etc/os-release \nNAME=\"Ubuntu\"\nVERSION=\"20.04 LTS (Focal Fossa)\"\nID=ubuntu\nID_LIKE=debian\nPRETTY_NAME=\"Ubuntu Focal Fossa (development branch)\"\nVERSION_ID=\"20.04\"\nHOME_URL=\"https://www.ubuntu.com/\"\nSUPPORT_URL=\"https://help.ubuntu.com/\"\nBUG_REPORT_URL=\"https://bugs.launchpad.net/ubuntu/\"\nPRIVACY_POLICY_URL=\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\"\nVERSION_CODENAME=focal\nUBUNTU_CODENAME=focal\n```\n\n```sh\n$ make\nGOOS=linux GOARCH=386 go build -o bin/helloworld_linux_x86 ./cmd/helloworld/\nGOOS=windows GOARCH=386 go build -o bin/helloworld_windows_x86.exe ./cmd/helloworld/\nGOOS=linux GOARCH=amd64 go build -o bin/helloworld_linux_x64 ./cmd/helloworld/\nGOOS=windows GOARCH=amd64 go build -o bin/helloworld_windows_x64.exe ./cmd/helloworld/\n\nhelloworld_linux_x64:       ELF 64-bit LSB executable, x86-64, version 1 (SYSV)\nhelloworld_linux_x86:       ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV)\nhelloworld_windows_x64.exe: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows\nhelloworld_windows_x86.exe: PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Fgo-crosscompile-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlights%2Fgo-crosscompile-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Fgo-crosscompile-example/lists"}