{"id":28578177,"url":"https://github.com/digitalocean/sample-functions-golang-random","last_synced_at":"2025-06-11T01:09:06.081Z","repository":{"id":38254624,"uuid":"481307230","full_name":"digitalocean/sample-functions-golang-random","owner":"digitalocean","description":"⛵ App Platform sample for a function that returns a random number.","archived":false,"fork":false,"pushed_at":"2025-05-06T16:54:15.000Z","size":111,"stargazers_count":3,"open_issues_count":1,"forks_count":11,"subscribers_count":74,"default_branch":"main","last_synced_at":"2025-05-06T17:49:58.726Z","etag":null,"topics":["app-sample"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalocean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2022-04-13T17:14:06.000Z","updated_at":"2025-05-05T02:51:00.000Z","dependencies_parsed_at":"2024-06-21T15:29:16.148Z","dependency_job_id":null,"html_url":"https://github.com/digitalocean/sample-functions-golang-random","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/digitalocean%2Fsample-functions-golang-random","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-golang-random/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-golang-random/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-golang-random/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalocean","download_url":"https://codeload.github.com/digitalocean/sample-functions-golang-random/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-golang-random/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259178519,"owners_count":22817388,"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":["app-sample"],"created_at":"2025-06-11T01:09:05.402Z","updated_at":"2025-06-11T01:09:06.024Z","avatar_url":"https://github.com/digitalocean.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sample Function: Go \"Random\"\n\n## Introduction\n\nThis repository contains a sample \"Random\" function written in Go. You can deploy it on DigitalOcean's App Platform as a Serverless Function component or as a standalone Function. Documentation is available at https://docs.digitalocean.com/products/functions.\n\n**Note: Following these steps may result in charges for the use of DigitalOcean services.**\n\n### Requirements\n\n* You need a DigitalOcean account. If you don't already have one, you can sign up at [https://cloud.digitalocean.com/registrations/new](https://cloud.digitalocean.com/registrations/new).\n* To deploy from the command line, you will need the [DigitalOcean `doctl` CLI](https://github.com/digitalocean/doctl/releases).\n\n## Deploying the Function\n\nClone this repo:\n\n```shell\ngit clone git@github.com:digitalocean/sample-functions-golang-random.git\n```\n\nDeploy the project, using a remote build so that compiled executable matches the runtime environment:\n\n```shell\ndoctl serverless deploy sample-functions-golang-random --remote-build\n```\n\nThe output from the deploy command will resemble the following:\n\n```\nDeploying 'sample-functions-golang-random'\n  to namespace 'fn-...'\n  on host '...'\nSubmitted function 'sample/random' for remote building and deployment in runtime go:default (id: ...)\nDeployment status recorded in 'sample-functions-golang-random/.deployed'\n\nDeployed functions ('doctl sls fn get \u003cfuncName\u003e --url' for URL):\n  - sample/random\n```\n\n## Using the Function\n\nInvoking the function will return a random number from 0 to 100.\n\n```\ndoctl serverless functions invoke sample/random\n```\n\nUse this command to retrieve the URL for your function and use it as an API.\n```\ndoctl sls fn get sample/random --url\n```\n\nYou can use that API directly in your browser, with `curl` or with an API platform such as Postman.\nParameters may be passed as query parameters, or as JSON body. Here is an example using `curl`.\n\n```\ncurl `doctl sls fn get sample/random --url`\n```\n\n### Learn More\n\nYou can learn more about Functions by reading the [Functions Documentation](https://docs.digitalocean.com/products/functions). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fsample-functions-golang-random","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalocean%2Fsample-functions-golang-random","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fsample-functions-golang-random/lists"}