Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions go-runner/src/builder/patcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ pub fn patch_imports<P: AsRef<Path>>(folder: P) -> anyhow::Result<()> {

let pattern = folder.join("**/*.go");
for go_file in glob::glob(pattern.to_str().unwrap())?.filter_map(Result::ok) {
// Skip directories - glob can match directories ending in .go (e.g., vendor/github.com/nats-io/nats.go)
if !go_file.is_file() {
continue;
}

let content =
fs::read_to_string(&go_file).context(format!("Failed to read Go file: {go_file:?}"))?;

Expand Down
1 change: 1 addition & 0 deletions go-runner/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ fn assert_results_snapshots(profile_dir: &Path, project_name: &str) {
#[case::example("example")]
#[case::example_with_helper("example-with-helper")]
#[case::example_with_main("example-with-main")]
#[case::example_with_dot_go_folder("example-with-dot-go-folder")]
#[test_log::test]
fn test_build_and_run(#[case] project_name: &str) {
let project_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
source: go-runner/src/integration_tests.rs
expression: results
---
[
{
"creator": {
"name": "codspeed-go",
"version": "[version]",
"pid": "[pid]"
},
"instrument": {
"type": "walltime"
},
"benchmarks": [
{
"name": "BenchmarkExample",
"uri": "go-runner/testdata/projects/example-with-dot-go-folder/bench_test.go::BenchmarkExample",
"config": {
"warmup_time_ns": null,
"min_round_time_ns": null,
"max_time_ns": null,
"max_rounds": null
},
"stats": "[stats]"
}
]
},
{
"creator": {
"name": "codspeed-go",
"version": "[version]",
"pid": "[pid]"
},
"instrument": {
"type": "walltime"
},
"benchmarks": [
{
"name": "BenchmarkInsideFolder",
"uri": "go-runner/testdata/projects/example-with-dot-go-folder/some_package.go/bench_test.go::BenchmarkInsideFolder",
"config": {
"warmup_time_ns": null,
"min_round_time_ns": null,
"max_time_ns": null,
"max_rounds": null
},
"stats": "[stats]"
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package dotgofoldertest

import "testing"

func BenchmarkExample(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = i * 2
}
}
3 changes: 3 additions & 0 deletions go-runner/testdata/projects/example-with-dot-go-folder/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module example.com/dot-go-folder-test

go 1.24
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package somepackage

import "testing"

func BenchmarkInsideFolder(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = i * 3
}
}
Loading