mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	chore: add comments
This commit is contained in:
		@@ -30,6 +30,8 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
var methodCtxKey struct{}
 | 
					var methodCtxKey struct{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// withMethod sets the notification method that this context currently executes.
 | 
				
			||||||
 | 
					// Used for debugging/ troubleshooting purposes.
 | 
				
			||||||
func withMethod(ctx context.Context, method string) context.Context {
 | 
					func withMethod(ctx context.Context, method string) context.Context {
 | 
				
			||||||
	// don't overwrite
 | 
						// don't overwrite
 | 
				
			||||||
	if v := ctx.Value(methodCtxKey); v != nil {
 | 
						if v := ctx.Value(methodCtxKey); v != nil {
 | 
				
			||||||
@@ -40,6 +42,9 @@ func withMethod(ctx context.Context, method string) context.Context {
 | 
				
			|||||||
	return context.WithValue(ctx, methodCtxKey, method)
 | 
						return context.WithValue(ctx, methodCtxKey, method)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// getMethod gets the notification method that this context currently executes.
 | 
				
			||||||
 | 
					// Default: "notify"
 | 
				
			||||||
 | 
					// Used for debugging/ troubleshooting purposes.
 | 
				
			||||||
func getMethod(ctx context.Context) string {
 | 
					func getMethod(ctx context.Context) string {
 | 
				
			||||||
	if v := ctx.Value(methodCtxKey); v != nil {
 | 
						if v := ctx.Value(methodCtxKey); v != nil {
 | 
				
			||||||
		if s, ok := v.(string); ok {
 | 
							if s, ok := v.(string); ok {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user