mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Add support for building "release" builds that don't contain pprof which are substantially smaller. To build a "debug" build, use "-tags debug" with "go build"
This commit is contained in:
		
							parent
							
								
									e9b1006dda
								
							
						
					
					
						commit
						a9e61d0d37
					
				
					 3 changed files with 31 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
// +build debug
 | 
			
		||||
 | 
			
		||||
package yggdrasil
 | 
			
		||||
 | 
			
		||||
// These are functions that should not exist
 | 
			
		||||
| 
						 | 
				
			
			@ -15,6 +17,20 @@ import "net"
 | 
			
		|||
import "log"
 | 
			
		||||
import "regexp"
 | 
			
		||||
 | 
			
		||||
import _ "net/http/pprof"
 | 
			
		||||
import "net/http"
 | 
			
		||||
import "runtime"
 | 
			
		||||
 | 
			
		||||
// Starts the function profiler. This is only supported when built with
 | 
			
		||||
// '-tags build'.
 | 
			
		||||
func StartProfiler(log *log.Logger) error {
 | 
			
		||||
	runtime.SetBlockProfileRate(1)
 | 
			
		||||
	go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }()
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
// Core
 | 
			
		||||
 | 
			
		||||
func (c *Core) DEBUG_getSigningPublicKey() sigPubKey {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								src/yggdrasil/release.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/yggdrasil/release.go
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
// +build !debug
 | 
			
		||||
 | 
			
		||||
package yggdrasil
 | 
			
		||||
 | 
			
		||||
import "errors"
 | 
			
		||||
import "log"
 | 
			
		||||
 | 
			
		||||
// Starts the function profiler. This is only supported when built with
 | 
			
		||||
// '-tags build'.
 | 
			
		||||
func StartProfiler(_ *log.Logger) error {
 | 
			
		||||
  return errors.New("Release builds do not support -pprof, build using '-tags debug'")
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue