@echo off
setlocal enabledelayedexpansion

rem Directory where the Go files are located
set GO_DIR=C:\path\to\your\go\files

rem Explicitly list the main files in the required order
set FILES=main.go init.go search-engine.go text.go text-google.go text-librex.go text-brave.go text-duckduckgo.go common.go cache.go agent.go files.go files-thepiratebay.go files-torrentgalaxy.go forums.go get-searchxng.go imageproxy.go images.go images-imgur.go images-quant.go map.go node.go open-search.go video.go

rem Change to the directory with the Go files
pushd %GO_DIR%

rem Find all other .go files that were not explicitly listed
set OTHER_GO_FILES=

for %%f in (*.go) do (
    set file=%%~nxf
    set found=0
    for %%i in (%FILES%) do (
        if /i "%%i"=="!file!" set found=1
    )
    if !found!==0 (
        set OTHER_GO_FILES=!OTHER_GO_FILES! "%%f"
    )
)

rem Run the Go program with the specified files first, followed by the remaining files
go run %FILES% %OTHER_GO_FILES%

rem Return to the original directory
popd