{"id":13342826,"url":"https://github.com/dgzlopes/xk6-interpret","last_synced_at":"2025-03-12T02:32:44.098Z","repository":{"id":47528862,"uuid":"316736764","full_name":"dgzlopes/xk6-interpret","owner":"dgzlopes","description":"A k6 extension for interpreting Go code.","archived":true,"fork":false,"pushed_at":"2021-10-07T15:18:03.000Z","size":253,"stargazers_count":10,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-07-30T21:05:24.590Z","etag":null,"topics":["k6","k6-extension","xk6","yaegi"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dgzlopes.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":"2020-11-28T13:11:10.000Z","updated_at":"2023-07-14T12:28:36.000Z","dependencies_parsed_at":"2022-07-21T02:48:53.396Z","dependency_job_id":null,"html_url":"https://github.com/dgzlopes/xk6-interpret","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/dgzlopes%2Fxk6-interpret","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgzlopes%2Fxk6-interpret/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgzlopes%2Fxk6-interpret/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgzlopes%2Fxk6-interpret/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgzlopes","download_url":"https://codeload.github.com/dgzlopes/xk6-interpret/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221265583,"owners_count":16788059,"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":["k6","k6-extension","xk6","yaegi"],"created_at":"2024-07-29T19:30:05.896Z","updated_at":"2024-10-24T02:30:35.687Z","avatar_url":"https://github.com/dgzlopes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xk6-interpret\n\nThis is a [k6](https://go.k6.io/k6) extension using the [xk6](https://github.com/grafana/xk6) system.\n\n| :exclamation: This is a TOY extension. USE AT YOUR OWN RISK! OR... DON'T USE IT! |\n|------|\n\n## Build\n\nTo build a `k6` binary with this extension, first ensure you have the prerequisites:\n\n- [Go toolchain](https://go101.org/article/go-toolchain.html)\n- Git\n\nThen:\n\n1. Install `xk6`:\n  ```shell\n  $ go install go.k6.io/xk6/cmd/xk6@latest\n  ```\n\n2. Build the binary:\n  ```shell\n  $ xk6 build --with github.com/dgzlopes/xk6-interpret@latest\n  ```\n\n## Example\n\n```javascript\nimport interpret from 'k6/x/interpret';\n\nexport default function() {\n    var result = interpret.run(\n    `package interpret\n    \n    import \"fmt\"\n\n\n    // fibonacci is a function that returns\n    // a function that returns an int.\n    func fibonacci() func() int {\n        x, y := 0, 1\n        return func() int {\n            x, y = y, x + y\n            fmt.Println(\"Calculated:\",x)\n            return x\n        }\n    }\n\n    func Run(s interface{}) interface{} {\n        f := fibonacci()\n        var results []int\n        var i int64\n        for i = 0; i \u003c s.(int64); i++ {\n            results = append(results,f())\n        }\n        return results\n    }\n    `,\n    10\n    );\n\n    console.log(`Results: ${result}`)\n}\n```\n\nResult output:\n\n```\n$ ./k6 run script.js\n\n          /\\      |‾‾| /‾‾/   /‾‾/   \n     /\\  /  \\     |  |/  /   /  /    \n    /  \\/    \\    |     (   /   ‾‾\\  \n   /          \\   |  |\\  \\ |  (‾)  | \n  / __________ \\  |__| \\__\\ \\_____/ .io\n\n  execution: local\n     script: ../example.js\n     output: -\n\n  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):\n           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)\n\nCalculated: 1\nCalculated: 2\nCalculated: 4\nCalculated: 8\nCalculated: 16\nCalculated: 32\nCalculated: 64\nCalculated: 128\nCalculated: 256\nCalculated: 512\nINFO[0000] Results: 1,2,4,8,16,32,64,128,256,512         source=console\n\nrunning (00m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations\ndefault ✓ [======================================] 1 VUs  00m00.0s/10m0s  1/1 iters, 1 per VU\n\n    data_received........: 0 B 0 B/s\n    data_sent............: 0 B 0 B/s\n    iteration_duration...: avg=1.16ms min=1.16ms med=1.16ms max=1.16ms p(90)=1.16ms p(95)=1.16ms\n    iterations...........: 1   66.559293/s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgzlopes%2Fxk6-interpret","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgzlopes%2Fxk6-interpret","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgzlopes%2Fxk6-interpret/lists"}