mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Integrate public as bindata optionally (#293)
* Dropped unused codekit config * Integrated dynamic and static bindata for public * Ignore public bindata * Add a general generate make task * Integrated flexible public assets into web command * Updated vendoring, added all missiong govendor deps * Made the linter happy with the bindata and dynamic code * Moved public bindata definition to modules directory * Ignoring the new bindata path now * Updated to the new public modules import path * Updated public bindata command and drop the new prefix
This commit is contained in:
		
				
					committed by
					
						
						Lunny Xiao
					
				
			
			
				
	
			
			
			
						parent
						
							4680c349dd
						
					
				
				
					commit
					b6a95a8cb3
				
			
							
								
								
									
										38
									
								
								vendor/github.com/juju/errors/path.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								vendor/github.com/juju/errors/path.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
// Copyright 2013, 2014 Canonical Ltd.
 | 
			
		||||
// Licensed under the LGPLv3, see LICENCE file for details.
 | 
			
		||||
 | 
			
		||||
package errors
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// prefixSize is used internally to trim the user specific path from the
 | 
			
		||||
// front of the returned filenames from the runtime call stack.
 | 
			
		||||
var prefixSize int
 | 
			
		||||
 | 
			
		||||
// goPath is the deduced path based on the location of this file as compiled.
 | 
			
		||||
var goPath string
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	_, file, _, ok := runtime.Caller(0)
 | 
			
		||||
	if file == "?" {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if ok {
 | 
			
		||||
		// We know that the end of the file should be:
 | 
			
		||||
		// github.com/juju/errors/path.go
 | 
			
		||||
		size := len(file)
 | 
			
		||||
		suffix := len("github.com/juju/errors/path.go")
 | 
			
		||||
		goPath = file[:size-suffix]
 | 
			
		||||
		prefixSize = len(goPath)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func trimGoPath(filename string) string {
 | 
			
		||||
	if strings.HasPrefix(filename, goPath) {
 | 
			
		||||
		return filename[prefixSize:]
 | 
			
		||||
	}
 | 
			
		||||
	return filename
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user