ROOTPLOIT
Server: LiteSpeed
System: Linux in-mum-web1878.main-hosting.eu 5.14.0-570.21.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 11 07:22:35 EDT 2025 x86_64
User: u435929562 (435929562)
PHP: 7.4.33
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/go/pkg/mod/github.com/mailru/[email protected]/parser/pkgpath_test.go
package parser

import "testing"

func Test_getModulePath(t *testing.T) {
	tests := map[string]struct {
		goModPath string
		want      string
	}{
		"valid go.mod without comments and deps": {
			goModPath: "./testdata/default.go.mod",
			want:      "example.com/user/project",
		},
		"valid go.mod with comments and without deps": {
			goModPath: "./testdata/comments.go.mod",
			want:      "example.com/user/project",
		},
		"valid go.mod with comments and deps": {
			goModPath: "./testdata/comments_deps.go.mod",
			want:      "example.com/user/project",
		},
		"actual easyjson go.mod": {
			goModPath: "../go.mod",
			want:      "github.com/mailru/easyjson",
		},
		"invalid go.mod with missing module": {
			goModPath: "./testdata/missing_module.go",
			want:      "",
		},
	}
	for name := range tests {
		tt := tests[name]
		t.Run(name, func(t *testing.T) {
			if got := getModulePath(tt.goModPath); got != tt.want {
				t.Errorf("getModulePath() = %v, want %v", got, tt.want)
			}
		})
	}
}