mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 18:57:18 +08:00 
			
		
		
		
	service: add min/max supported ver and target ver to GetVersion resp (#1718)
Fixes #1713
This commit is contained in:
		 Alessandro Arzilli
					Alessandro Arzilli
				
			
				
					committed by
					
						 Derek Parker
						Derek Parker
					
				
			
			
				
	
			
			
			 Derek Parker
						Derek Parker
					
				
			
						parent
						
							6c8c4508db
						
					
				
				
					commit
					d064d1fe05
				
			| @ -5,10 +5,12 @@ import ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| var ( | var ( | ||||||
| 	minSupportedVersionOfGoMinor = 11 | 	MinSupportedVersionOfGoMajor = 1 | ||||||
| 	maxSupportedVersionOfGoMinor = 13 | 	MinSupportedVersionOfGoMinor = 11 | ||||||
| 	goTooOldErr                  = fmt.Errorf("Version of Go is too old for this version of Delve (minimum supported version 1.%d, suppress this error with --check-go-version=false)", minSupportedVersionOfGoMinor) | 	MaxSupportedVersionOfGoMajor = 1 | ||||||
| 	dlvTooOldErr                 = fmt.Errorf("Version of Delve is too old for this version of Go (maximum supported version 1.%d, suppress this error with --check-go-version=false)", maxSupportedVersionOfGoMinor) | 	MaxSupportedVersionOfGoMinor = 13 | ||||||
|  | 	goTooOldErr                  = fmt.Errorf("Version of Go is too old for this version of Delve (minimum supported version %d.%d, suppress this error with --check-go-version=false)", MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor) | ||||||
|  | 	dlvTooOldErr                 = fmt.Errorf("Version of Delve is too old for this version of Go (maximum supported version %d.%d, suppress this error with --check-go-version=false)", MaxSupportedVersionOfGoMajor, MaxSupportedVersionOfGoMinor) | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Compatible checks that the version specified in the producer string is compatible with | // Compatible checks that the version specified in the producer string is compatible with | ||||||
| @ -18,10 +20,10 @@ func Compatible(producer string) error { | |||||||
| 	if ver.IsDevel() { | 	if ver.IsDevel() { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	if !ver.AfterOrEqual(GoVersion{1, minSupportedVersionOfGoMinor, -1, 0, 0, ""}) { | 	if !ver.AfterOrEqual(GoVersion{MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor, -1, 0, 0, ""}) { | ||||||
| 		return goTooOldErr | 		return goTooOldErr | ||||||
| 	} | 	} | ||||||
| 	if ver.AfterOrEqual(GoVersion{1, maxSupportedVersionOfGoMinor + 1, -1, 0, 0, ""}) { | 	if ver.AfterOrEqual(GoVersion{MaxSupportedVersionOfGoMajor, MaxSupportedVersionOfGoMinor + 1, -1, 0, 0, ""}) { | ||||||
| 		return dlvTooOldErr | 		return dlvTooOldErr | ||||||
| 	} | 	} | ||||||
| 	return nil | 	return nil | ||||||
|  | |||||||
| @ -413,9 +413,13 @@ type GetVersionIn struct { | |||||||
|  |  | ||||||
| // GetVersionOut is the result of GetVersion. | // GetVersionOut is the result of GetVersion. | ||||||
| type GetVersionOut struct { | type GetVersionOut struct { | ||||||
| 	DelveVersion string | 	DelveVersion    string | ||||||
| 	APIVersion   int | 	APIVersion      int | ||||||
| 	Backend      string // backend currently in use | 	Backend         string // backend currently in use | ||||||
|  | 	TargetGoVersion string | ||||||
|  |  | ||||||
|  | 	MinSupportedVersionOfGo string | ||||||
|  | 	MaxSupportedVersionOfGo string | ||||||
| } | } | ||||||
|  |  | ||||||
| // SetAPIVersionIn is the input for SetAPIVersion. | // SetAPIVersionIn is the input for SetAPIVersion. | ||||||
|  | |||||||
| @ -1280,6 +1280,12 @@ func (d *Debugger) GetVersion(out *api.GetVersionOut) error { | |||||||
| 			out.Backend = d.config.Backend | 			out.Backend = d.config.Backend | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	out.TargetGoVersion = d.target.BinInfo().Producer() | ||||||
|  |  | ||||||
|  | 	out.MinSupportedVersionOfGo = fmt.Sprintf("%d.%d.0", goversion.MinSupportedVersionOfGoMajor, goversion.MinSupportedVersionOfGoMinor) | ||||||
|  | 	out.MaxSupportedVersionOfGo = fmt.Sprintf("%d.%d.0", goversion.MaxSupportedVersionOfGoMajor, goversion.MaxSupportedVersionOfGoMinor) | ||||||
|  |  | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user