当我在visual studio代码中调试Go Lang代码时,出现以下错误消息:
QUOTE_STRINGS = ("'", "\\'", '"', '\\"') # a list of substring considered a 'quote'
def replace_multiple(source, replacements): # a convenience multi-replacement function
if not source: # no need to process empty strings
return ""
for r in replacements:
source = source.replace(r[0], r[1])
return source
def replace_non_quoted(source, replacements):
result = [] # a store for the result pieces
head = 0 # a search head reference
eos = len(source) # a convenience string length reference
quote = None # last quote match literal
quote_len = 0 # a convenience reference to the current quote substring length
while True:
if quote: # we already have a matching quote stored
index = source.find(quote, head + quote_len) # find the closing quote
if index == -1: # EOS reached
break
result.append(source[head:index + quote_len]) # add the quoted string verbatim
head = index + quote_len # move the search head after the quoted match
quote = None # blank out the quote literal
else: # the current position is not in a quoted substring
index = eos
# find the first quoted substring from the current head position
for entry in QUOTE_STRINGS: # loop through all quote substrings
candidate = source.find(entry, head)
if head < candidate < index:
index = candidate
quote = entry
quote_len = len(entry)
if not quote: # EOS reached, no quote found
break
result.append(replace_multiple(source[head:index], replacements))
head = index # move the search head to the start of the quoted match
if head < eos: # if the search head is not at the end of the string
result.append(replace_multiple(source[head:], replacements))
return "".join(result) # join back the result pieces and return them
答案 0 :(得分:3)
我尝试了下面的场景并且它有效..
<form action="/" method="post">
答案 1 :(得分:1)
我有同样的事情。最新的XCode更新破坏了调试器api中的内容。 (我怀疑这只是class Post(models.Model):
STATUS_CHOICES = (
("draft", "Draft"),
("published", "Published")
);
slug = models.SlugField(max_length=250);
wine_id = models.IntegerField();
country = models.CharField(max_length=100);
description = models.TextField();
designation = models.TextField();
price = models.FloatField();
province = models.CharField(max_length=100);
region_1 = models.CharField(max_length=100);
region_2 = models.CharField(max_length=100);
variety = models.CharField(max_length=100);
winery = models.CharField(max_length=100);
objects = models.Manager();
class Meta:
ordering = ("id",);
def __str__(self):
return self.variety;
def get_absolute_url(self):
return reverse("post_detail", args=[self.id,
self.province,
self.slug]);
命令行标志的变化。)
目前,我所知道的最佳解决方案是卸载XCode或XCode命令行工具,并为MacOS High Sierra或MacOs Sierra安装命令行工具9.2。
安装,并且在XCode或Delve中修复之前不要升级XCode。