1. 22 Sep, 2011 5 commits
    • Andrew Gerrand's avatar
      weekly.2011-09-21 · e4ac43b7
      Andrew Gerrand authored
      R=golang-dev, dsymonds
      CC=golang-dev
      https://golang.org/cl/5075050
      e4ac43b7
    • Mike Samuel's avatar
      exp/template/html: elide comments in template source. · 35819729
      Mike Samuel authored
      When templates are stored in external files, developers often embed
      comments to explain&|disable code.
      
        <!-- Oblique reference to project code name here -->
        {{if .C}}...{{else}}<!-- commented out default -->{{end}}
      
      This unnecessarily increases the size of shipped HTML and can leak
      information.
      
      This change elides all comments of the following types:
      1. <!-- ... --> comments found in source.
      2. /*...*/ and // comments found in <script> elements.
      3. /*...*/ and // comments found in <style> elements.
      
      It does not elide /*...*/ or // comments found in HTML attributes:
      4. <button onclick="/*...*/">
      5. <div style="/*...*/">
      
      I can find no examples of comments in attributes in Closure Templates
      code and doing so would require keeping track of character positions
      post decode in
      
        <button onclick="/&#42;...*/">
      
      To prevent token joining, /*comments*/ are JS and CSS comments are
      replaced with a whitespace char.
      HTML comments are not, but to prevent token joining we could try to
      detect cases like
         <<!---->b>
         </<!---->b>
      which has a well defined meaning in HTML but will cause a validator
      to barf.  This is difficult, and this is a very minor case.
      I have punted for now, but if we need to address this case, the best
      way would be to normalize '<' in stateText to '&lt;' consistently.
      
      The whitespace to replace a JS /*comment*/ with depends on whether
      there is an embedded line terminator since
          break/*
          */foo
          ...
      is equivalent to
          break;
          foo
          ...
      while
          break/**/foo
          ...
      is equivalent to
          break foo;
          ...
      
      Comment eliding can interfere with IE conditional comments.
      http://en.wikipedia.org/wiki/Conditional_comment
      
      <!--[if IE 6]>
      <p>You are using Internet Explorer 6.</p>
      <![endif]-->
      
      /*@cc_on
        document.write("You are using IE4 or higher");
      @*/
      
      I have not encountered these in production template code, and
      the typed content change in CL 4962067 provides an escape-hatch
      if conditional comments are needed.
      
      R=nigeltao
      CC=golang-dev
      https://golang.org/cl/4999042
      35819729
    • David Symonds's avatar
      A&C: Add Paul Sbarra. · 7eab0c2b
      David Symonds authored
      R=golang-dev, adg
      CC=golang-dev, sbarra.paul
      https://golang.org/cl/5044045
      7eab0c2b
    • Mike Samuel's avatar
      exp/template/html: simplify transition functions · 1f577d26
      Mike Samuel authored
      This simplifies transition functions to make it easier to reliably
      elide comments in a later CL.
      
      Before:
      - transition functions are responsible for detecting special end tags.
      After:
      - the code to detect special end tags is done in one place.
      
      We were relying on end tags being skipped which meant we were
      not noticing comments inside script/style elements that contain no
      substitutions.
      This change means we will notice all such comments where necessary,
      but stripTags will notice none since it does not need to.  This speeds
      up stripTags.
      
      R=nigeltao
      CC=golang-dev
      https://golang.org/cl/5074041
      1f577d26
    • Ian Lance Taylor's avatar
      test: match gccgo error messages · 9169c27e
      Ian Lance Taylor authored
      bug363.go:13:12: error: invalid context-determined non-integer type for shift operand
      bug363.go:16:12: error: invalid context-determined non-integer type for shift operand
      
      pointer.go:34:6: error: incompatible type in initialization (pointer to interface type has no methods)
      pointer.go:36:6: error: incompatible type in initialization
      
      method2.go:15:1: error: invalid pointer or interface receiver type
      method2.go:16:1: error: invalid pointer or interface receiver type
      method2.go:21:1: error: invalid pointer or interface receiver type
      method2.go:22:1: error: invalid pointer or interface receiver type
      method2.go:28:15: error: type ‘*Val’ has no method ‘val’
      method2.go:33:11: error: reference to undefined field or method ‘val’
      
      shift1.go:19:16: error: invalid context-determined non-integer type for shift operand
      shift1.go:24:19: error: invalid context-determined non-integer type for shift operand
      shift1.go:25:17: error: invalid context-determined non-integer type for shift operand
      shift1.go:18:18: error: shift of non-integer operand
      shift1.go:26:13: error: floating point constant truncated to integer
      shift1.go:33:15: error: integer constant overflow
      shift1.go:34:15: error: integer constant overflow
      shift1.go:35:17: error: integer constant overflow
      
      R=golang-dev, r
      CC=golang-dev
      https://golang.org/cl/5081051
      9169c27e
  2. 21 Sep, 2011 6 commits
  3. 20 Sep, 2011 14 commits
    • Ian Lance Taylor's avatar
      test: match gccgo error messages · 1f275199
      Ian Lance Taylor authored
      Added a return to bug357.go to avoid an error which gccgo
      reports but 6g does not.
      
      bug353.go:16:14: error: reference to undefined identifer ‘io.ReadWriterCloser’
      
      bug357.go:18:2: error: value computed is not used
      
      bug358.go:14:11: error: imported and not used: ioutil
      bug358.go:19:9: error: invalid use of type
      
      bug359.go:25:14: error: redefinition of ‘a’
      bug359.go:25:6: note: previous definition of ‘a’ was here
      bug359.go:19:6: error: incompatible type in initialization (implicit assignment of ‘list.List’ hidden field ‘front’)
      
      bug362.go:13:6: error: iota is only defined in const declarations
      bug362.go:14:6: error: iota is only defined in const declarations
      bug362.go:15:6: error: iota is only defined in const declarations
      
      bug363.go:13:12: error: shift of non-integer operand
      bug363.go:16:12: error: shift of non-integer operand
      
      bug365.go:15:8: error: expected package
      
      R=golang-dev, gri
      CC=golang-dev
      https://golang.org/cl/5078046
      1f275199
    • Ian Lance Taylor's avatar
      test: match gccgo error messages for bug349.go · 86d97aa9
      Ian Lance Taylor authored
      bug349.go:12:14: error: expected ‘;’ or ‘}’ or newline
      bug349.go:12:2: error: not enough arguments to return
      
      R=golang-dev, gri
      CC=golang-dev
      https://golang.org/cl/5081047
      86d97aa9
    • Ian Lance Taylor's avatar
      test: match gccgo error messages for goto.go and bug344.go · f1aefc0d
      Ian Lance Taylor authored
      goto.go:39:2: error: goto jumps over declaration of ‘x’
      goto.go:40:2: note: ‘x’ defined here
      goto.go:57:2: error: goto jumps over declaration of ‘x’
      goto.go:62:2: note: ‘x’ defined here
      goto.go:77:2: error: goto jumps over declaration of ‘x’
      goto.go:78:2: note: ‘x’ defined here
      goto.go:87:2: error: goto jumps over declaration of ‘x’
      goto.go:88:2: note: ‘x’ defined here
      goto.go:114:2: error: goto jumps into block
      goto.go:115:2: note: goto target block starts here
      goto.go:125:2: error: goto jumps into block
      goto.go:122:2: note: goto target block starts here
      goto.go:130:2: error: goto jumps into block
      goto.go:133:4: note: goto target block starts here
      goto.go:142:2: error: goto jumps into block
      goto.go:145:2: note: goto target block starts here
      goto.go:179:2: error: goto jumps into block
      goto.go:180:10: note: goto target block starts here
      goto.go:186:2: error: goto jumps into block
      goto.go:187:10: note: goto target block starts here
      goto.go:194:2: error: goto jumps into block
      goto.go:196:4: note: goto target block starts here
      goto.go:205:3: error: goto jumps into block
      goto.go:202:11: note: goto target block starts here
      goto.go:211:3: error: goto jumps into block
      goto.go:212:4: note: goto target block starts here
      goto.go:219:3: error: goto jumps into block
      goto.go:220:18: note: goto target block starts here
      goto.go:227:3: error: goto jumps into block
      goto.go:228:18: note: goto target block starts here
      goto.go:241:3: error: goto jumps into block
      goto.go:243:4: note: goto target block starts here
      goto.go:290:2: error: goto jumps into block
      goto.go:287:6: note: goto target block starts here
      goto.go:299:2: error: goto jumps into block
      goto.go:294:6: note: goto target block starts here
      goto.go:306:2: error: goto jumps into block
      goto.go:303:12: note: goto target block starts here
      goto.go:313:2: error: goto jumps into block
      goto.go:310:24: note: goto target block starts here
      goto.go:320:2: error: goto jumps into block
      goto.go:317:18: note: goto target block starts here
      goto.go:327:2: error: goto jumps into block
      goto.go:324:18: note: goto target block starts here
      goto.go:334:2: error: goto jumps into block
      goto.go:331:18: note: goto target block starts here
      goto.go:341:2: error: goto jumps into block
      goto.go:338:18: note: goto target block starts here
      goto.go:395:2: error: goto jumps into block
      goto.go:398:2: note: goto target block starts here
      goto.go:403:2: error: goto jumps into block
      goto.go:406:2: note: goto target block starts here
      goto.go:413:2: error: goto jumps into block
      goto.go:417:2: note: goto target block starts here
      goto.go:424:3: error: goto jumps into block
      goto.go:426:2: note: goto target block starts here
      goto.go:436:3: error: goto jumps into block
      goto.go:433:2: note: goto target block starts here
      goto.go:492:2: error: goto jumps into block
      goto.go:495:2: note: goto target block starts here
      goto.go:500:2: error: goto jumps into block
      goto.go:503:2: note: goto target block starts here
      goto.go:510:2: error: goto jumps into block
      goto.go:514:2: note: goto target block starts here
      goto.go:521:3: error: goto jumps into block
      goto.go:523:2: note: goto target block starts here
      goto.go:533:3: error: goto jumps into block
      goto.go:530:2: note: goto target block starts here
      
      bug344.go:17:2: error: goto jumps into block
      bug344.go:20:21: note: goto target block starts here
      
      R=rsc
      CC=golang-dev
      https://golang.org/cl/5077044
      f1aefc0d
    • Robert Griesemer's avatar
      suffixarray: improved serialization code · 5ee7ef90
      Robert Griesemer authored
      Use gobs to serialize indexes instead of encoding/binary.
      
      Even with gobs, serialize data in slices instead of
      applying gob to the entire data structure at once,
      to reduce the amount of extra buffer memory needed
      inside gob.
      
      7x faster Write/Read for new BenchmarkSaveRestore
      compared to old code; possibly because encoding/binary
      is more expensive for int32 slice elements (interface
      call to get little/big endian encoding), while gob's
      encoding is fixed (unconfirmed).
      
      new (using gobs):
      suffixarray.BenchmarkSaveRestore	       1	2153604000 ns/op
      
      old (using encoding/binary):
      suffixarray.BenchmarkSaveRestore	       1	15118322000 ns/op
      
      The actual serialized data is slightly larger then using
      the old code for very large indices because full 32bit indices
      require 5bytes using gobs instead of 4bytes (encoding/binary)
      in serialized form.
      
      R=r
      CC=golang-dev
      https://golang.org/cl/5087041
      5ee7ef90
    • Rob Pike's avatar
    • Brad Fitzpatrick's avatar
      httptest: add NewUnstartedServer · 76e70531
      Brad Fitzpatrick authored
      This allows testing TLS with different http.Server
      options (timeouts, limits).
      
      R=golang-dev, rsc
      CC=golang-dev
      https://golang.org/cl/5094043
      76e70531
    • Russ Cox's avatar
      codereview: save CL messages in $(hg root)/last-change · 762729b5
      Russ Cox authored
      Fixes #2279.
      
      R=bradfitz, r, r
      CC=golang-dev
      https://golang.org/cl/5096042
      762729b5
    • Rob Pike's avatar
      gob: fix allocation for singletons. · 9ddc2b56
      Rob Pike authored
      Code was double-allocating in some cases.
      Fixes #2267.
      
      R=golang-dev, rsc
      CC=golang-dev
      https://golang.org/cl/5093042
      9ddc2b56
    • Ian Lance Taylor's avatar
      test: match gccgo error message for bug337.go · c55d0c4d
      Ian Lance Taylor authored
      bug337.go:17:2: error: value computed is not used
      
      R=golang-dev, rsc
      CC=golang-dev
      https://golang.org/cl/5094042
      c55d0c4d
    • Dave Cheney's avatar
      exp/ssh: refactor halfConnection to transport · fd397855
      Dave Cheney authored
              This CL generalises the pair of halfConnection members that the
              serverConn holds into a single transport struct that is shared by
              both Server and Client, see also CL 5037047.
      
              This CL is a replacement for 5040046 which I closed by accident.
      
      R=agl, bradfitz
      CC=golang-dev
      https://golang.org/cl/5075042
      fd397855
    • Mike Samuel's avatar
      exp/template/html: change transition functions to return indices · 3a013f11
      Mike Samuel authored
      Formulaic changes to transition functions in preparation for CL 5074041.
      This should be completely semantics preserving.
      
      R=nigeltao
      CC=golang-dev
      https://golang.org/cl/5091041
      3a013f11
    • Brad Fitzpatrick's avatar
      http: fix TLS handshake blocking server accept loop · 3c3a86cc
      Brad Fitzpatrick authored
      Fixes #2263
      
      R=golang-dev, adg
      CC=golang-dev
      https://golang.org/cl/5076042
      3c3a86cc
    • Mike Samuel's avatar
      exp/template/html: allow commenting out of actions · 8bc5ef6c
      Mike Samuel authored
      Instead of erroring on actions inside comments, use existing escaping
      pipeline to quash the output of actions inside comments.
      
      If a template maintainer uses a comment to disable template code:
      
        {{if .}}Hello, {{.}}!{{end}}
      
      ->
      
        <!--{{if true}}Hello, {{.}}!{{end}}-->
      
      will result in
      
        <!--Hello, !-->
      
      regardless of the value of {{.}}.
      
      In a later CL, comment elision will result in the entire commented-out
      section being dropped from the template output.
      
      Any side-effects in pipelines, such as panics, will still be realized.
      
      R=nigeltao
      CC=golang-dev
      https://golang.org/cl/5078041
      8bc5ef6c
    • Mike Samuel's avatar
      exp/template/html: define isComment helper · 533b3722
      Mike Samuel authored
      Non semantics-changing refactoring in preparation for comment elision.
      
      R=nigeltao
      CC=golang-dev
      https://golang.org/cl/5071043
      533b3722
  4. 19 Sep, 2011 15 commits