77use SPC \store \Downloader ;
88use SPC \store \FileSystem ;
99use SPC \store \LockFile ;
10+ use SPC \util \GlobalEnvManager ;
1011
1112class GoModFrankenphp extends CustomPackage
1213{
@@ -22,6 +23,12 @@ public function getSupportName(): array
2223
2324 public function fetch (string $ name , bool $ force = false , ?array $ config = null ): void
2425 {
26+ $ pkgroot = PKG_ROOT_PATH ;
27+ $ go_exec = "{$ pkgroot }/ {$ name }/bin/go " ;
28+ $ xcaddy_exec = "{$ pkgroot }/ {$ name }/bin/xcaddy " ;
29+ if (file_exists ($ go_exec ) && file_exists ($ xcaddy_exec )) {
30+ return ;
31+ }
2532 $ arch = match (explode ('- ' , $ name )[3 ]) {
2633 'x86_64 ' => 'amd64 ' ,
2734 'aarch64 ' => 'arm64 ' ,
@@ -43,16 +50,20 @@ public function fetch(string $name, bool $force = false, ?array $config = null):
4350 public function extract (string $ name ): void
4451 {
4552 $ pkgroot = PKG_ROOT_PATH ;
53+ $ go_exec = "{$ pkgroot }/ {$ name }/bin/go " ;
54+ $ xcaddy_exec = "{$ pkgroot }/ {$ name }/bin/xcaddy " ;
55+ if (file_exists ($ go_exec ) && file_exists ($ xcaddy_exec )) {
56+ return ;
57+ }
4658 $ lock = json_decode (FileSystem::readFile (LockFile::LOCK_FILE ), true );
4759 $ source_type = $ lock [$ name ]['source_type ' ];
4860 $ filename = DOWNLOAD_PATH . '/ ' . ($ lock [$ name ]['filename ' ] ?? $ lock [$ name ]['dirname ' ]);
4961 $ extract = $ lock [$ name ]['move_path ' ] === null ? "{$ pkgroot }/ {$ name }" : $ lock [$ name ]['move_path ' ];
5062
5163 FileSystem::extractPackage ($ name , $ source_type , $ filename , $ extract );
5264
65+ GlobalEnvManager::init ();
5366 // install xcaddy
54- $ go_exec = "{$ pkgroot }/ {$ name }/bin/go " ;
55- // $xcaddy_exec = PKG_ROOT_PATH . "$pkgroot/$name/bin/xcaddy";
5667 shell ()
5768 ->appendEnv ([
5869 'PATH ' => "{$ pkgroot }/ {$ name }/bin: " . getenv ('PATH ' ),
0 commit comments